Display only posts with thumbnails
Display only posts with thumbnails
Display only posts with thumbnails
Yes, there is — use a meta_query with 2 clauses, one which selects posts having the meta, and the second clause with a ‘compare’ => ‘NOT EXISTS’ which selects posts without that meta. So in your $args array, just replace the ‘meta_key’ => ‘pld_like_count’ with this one: ‘meta_query’ => array( // make sure it’s OR … Read more
Meta Query compare with LIKE pulls similar post types: 55 and 155, and 1,155
WP Query returning all posts when Meta_query is null
It isn’t reading the acceptable image type parameter because there is no code to read it, and the acceptable image types have been hardcoded here: array( ‘key’ => ‘accepted_image_type’, ‘value’ => array(‘print’, ‘glass-plate’), ‘compare’ => ‘IN’, ), Much like you did here for the search parameter: $search_query = $data[‘s’]; It needs to do the same … Read more
Your query syntax looked good, although you could instead add a direct meta/taxonomy query clause array such as $meta_query[] = array( ‘key’ => ‘_price’, … ) instead of $meta_query[] = array( ‘relation’ => ‘AND’, array( ‘key’ => ‘_price’, … ) ). However, I spotted 2 main issues with your code: Issue 1: Your custom pagination … Read more
pre_get_posts is an action hook used for modifying the arguments passed to the WP_Query class, and if you’re filtering the posts in the list table at wp-admin/edit.php, then yes, you would use that hook. However, since you’re filtering the terms in the list table at wp-admin/edit-tags.php, then the hook that you should have used is … Read more
To show the proper count for the ‘Redacted’ link on the ‘all comments’ table list, you can use the get_comments() function to get the total number of ‘redacted’ comments and then update the link text to include this count. Here is an example of how you can modify the my_comment_link_add() function to do this: function … Read more
Ordering WP_Query results by second meta_key
WP Query Args – search by meta_key or title