Why WP_Query with the same arguments retrieves different results?
Why WP_Query with the same arguments retrieves different results?
Why WP_Query with the same arguments retrieves different results?
Filtering custom post type list in admin by custom meta key/value
For just print the query object put this in your function.php: add_action(‘wp_footer’, function () { global $wp_query; echo ‘<pre>’; print_r($wp_query); echo ‘</pre>’; die; });
Use this code instead- $supplierArgs = array( ‘post_type’ => ‘service_providers’, ‘meta_query’ => array( ‘relation’ => ‘OR’, array( ‘key’ => ‘service_provider_tier’, ‘value’ => ‘G’, ‘compare’ => ‘=’ ), array( ‘key’ => ‘service_provider_tier’, ‘value’ => ‘S’, ‘compare’ => ‘=’ ), array( ‘key’ => ‘service_provider_tier’, ‘value’ => ‘B’, ‘compare’ => ‘=’ ), ), ‘orderby’ => ‘meta_value’, ‘meta_key’ => … Read more
Use custom url params with value from a custom field to return the post containing the field value
meta_query post_date not returning results
You can add taxonomy-subtopic-copyright.php and taxonomy-subtopic-trademark.php archive templates if you need that much granularity.
wp_query returns all posts even with post__in and posts_per_page
Try this WP_Query arguments: $args = array( ‘post__in’ => $all_ids, ‘meta_query’ => array( ‘relation’ => ‘OR’, array( ‘key’ => ‘_event_date’, ‘compare’ => ‘EXISTS’, ), array( ‘key’ => ‘_event_date’, ‘compare’ => ‘NOT EXISTS’, ‘value’ => ‘dummy_value’ // This is just to ensure this condition gets evaluated. ) ), ‘orderby’ => array( ‘meta_value_num’ => ‘DESC’, ‘date’ => … Read more
You should really just forget about the first code in your post/question, but anyway, what you’re trying to achieve can be accomplished either by sorting at the database level or PHP level, and you would probably want to use the latter if pagination is not needed. But that is up to you to decide. Option … Read more