Use WP_Query Data In Cookie

You could try serializing the array so that it becomes a flattened textual representation of the values it contains. e.g. $testArr = [3,4,”test”, 56]; echo serialize($testArr); gives: a:4:{i:0;i:3;i:1;i:4;i:2;s:4:”test”;i:3;i:56;} However, you should probably consider using user sessions for this rather than cookies.

Pagination reset problem

Simply put, you need different paged variables for each paged element on the same page. Otherwise, like it happens for you, they will use the same and logically be on the same page. The codex entry for paginate_links() gives a basic example for the usage of the paged variable. Now for an explanation on how … Read more

WP_Post is not from correct array

get_the_ID gives you the ID of the current post, but at no point during that loop do you change what the current post is. It’s always the last post processed in the previous loop because that’s the last time you called the_post(). This is why you always get the same ID. Instead, store the ID: … Read more

wp_nav_menu prints children with parent name

wp_nav_menu displays the menu created in the Appearences > Menu section of wordpress admin area. That is where you can “print the menu with correct children names”. Unless there is some other code in your functions that is messing with the wp_nav_menu function.

Count posts per post-type for last month/week

Besides this suggestion, here is a simple SQL query adapted from the core wp_get_archives function: SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM wp_posts WHERE post_type=”post” AND post_status=”publish” GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC This would provide with a structure like this: +——+——-+——-+ | year | month | posts | … Read more

Access preview settings in php

It seems that the problem was that I was adding the function to ‘init’ and where the preview was not updated. Adding it to wp_enqueue_script solved my issue. Changed add_action(‘init’, ‘autoCompileLess’); to add_action(‘wp_enqueue_scripts’, ‘autoCompileLess’);

Nonce fail after second submit attempt

Not 100 % positive but my understanding is that a Nonce expire as soon as you use it. It can only be used for one transaction. So it seems to be logic that it expire after the first call. You should probably return a new one with the response of your first validated request and … Read more

Accessing values entered via form – try again

You are right the action part is the directory to the execution script file. You can not use the static directory path like that, it should be used with get_home_path(); like $path = get_home_path(); then action = ‘<?php echo $path.”wp-includes/tests-form.php” ?>’; More: https://codex.wordpress.org/Function_Reference/get_home_path