Compare WP Custom Field date

Take a look at meta.php:777: … CAST($alias.meta_value AS {$meta_type}) {$meta_compare} {$meta_compare_string})… So if you want to use DATE comparisons, you should use MySQL compatible date formats (YYYY-MM-DD). Change this part of your code: array( ‘key’ => ‘date’, ‘value’ => date(“Y/m/d”), ‘compare’ => ‘>=’, ‘type’ => ‘DATE’ ), to: array( ‘key’ => ‘date’, ‘value’ => date(“Y-m-d”), … Read more

Arrange BBpress topics by created

Add this to a plugin or your active themes functions.php function my_custom_display_topic_index_query () { $args[‘orderby’] = ‘date’; $args[‘order’] = ‘DESC’; return $args; } add_filter(‘bbp_before_has_topics_parse_args’, ‘my_custom_display_topic_index_query’ );

Custom Post order for homepage

From a naming standpoint it seems that the term “filter” would be more appropriate since you are filtering by criteria first and then a sort (directional) is applied when you order. But that’s more a naming convention standpoint… From a code structure if you are using the check_for_popular() method in several places then it makes … Read more

Why query_vars get altered in WP_Query Object?

Milo’s comment about pre_get_posts helped solve this issue for me. In my case the parent theme used the pre_get_posts action to explicitly set the post_type for all author pages. It wasn’t in the functions.php, but I was able to find it by searching the theme for instances of pre_get_posts. (I used grep -R “pre_get_posts” . … Read more