Using Cookie Data For WP_Query Loop

You need to explode the comma separated string to get the array of IDs. Follow the below code. $cookie_array = $_COOKIE[“your-results”]; // Test output echo $cookie_array; $cookie_array = array_map( ‘absint’, (array) explode(‘,’, $cookie_array) ); $sug_args = array( ‘post_type’ => ‘product’, ‘post__in’ => $cookie_array, ); $sug_query = new WP_query ($sug_args); if( $sug_query->have_posts() ) : while( $sug_query->have_posts() … Read more

Setcookie works on admin but not front end

Some things non-WordPress specific regarding cookies: set cookie fails if some output has been done in the page you can’t access to coockie value in the same request you set it (as @Milo pointed out in a comment to OP) Another general rule is better to use filter_input or filter_intput_array instead of direct accessing to … Read more

wp_logout action not working

pls try below code function remove_user_cookie() { setcookie(“woak”); setcookie(“woai”); } add_action(‘wp_logout’, ‘remove_user_cookie’); apart why you use cookie to storing some value ? suggest you to use session

How to transition cookies from .subdomain.domain.com to .domain.com with minimal impact on users?

This answer may help. To quote: The basic code you need here is this in the wp-config file: define(‘LOGGED_IN_COOKIE’, ‘login_cookie_name’); define(‘AUTH_COOKIE’,’auth_cookie_name’); define(‘COOKIE_DOMAIN’, ‘.example.com’); define(‘COOKIEHASH’, ‘random_hash_here’); Put that in the config across multiple sites, set the keys and salts to be the same, and you’ll have login cookies that work across the domain and subdomains.

Authentication/API Questions

Why don’t you write a quick plugin … called “is user logged in” that registers a URL call. So the user hits the page, then the Flash or Java could just hit: http://mysite.com/customurl?hash=wordpress_logged_in_[hash] Then the plugin would run and return true or false. References: http://codex.wordpress.org/WordPress_Cookies#WP_.3E_3 This way you keep everything within reach of the WordPress … Read more

Do I use cookies?

Yes, any WordPress site does uses cookies. By default, WordPress uses cookies to verify who the user is, i.e. if the user is logged-in (registered user) or is a commenter on the site. (More Info.) Plugins and theme’s may set cookies. For example, Cookies for Comments plugin uses cookies to prevent comment spam. Cookies have … Read more

Setting a redirect cookie in wordpress

So the only part that is missing from your code is checking what page you are currently on. The is_page() function is a good way to get this context. You could try it this way (I did not test it, only writeup out of my head to show the concept): function set_newuser_cookie() { if (!isset($_COOKIE[‘subscriber’]) … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)