WordPress query vars are not added
WordPress query vars are not added
WordPress query vars are not added
I did look at your code and saw you changed the original code. To make it more clear what you can achieve with this snippet. You would end up with the following permalinks: /recetas-argentinas/category/desserts Shows all post with the post_type recetas-argentinas and with the category desserts. /recetas-argentinas/my-single-recept-post Shows a single post of the post_type recetas-argentinas. … Read more
After further testing, the problem was found to be caused by another filter, posts_where, which was registered to support searching also in custom fields, and that’s why only searching is affected. Originally it generates something like this, so if the OR statement returns true (when one of the custom fields includes foo), that post will … Read more
Solved. Had a custom author drop down function that causes a large query loop. add_filter(‘wp_dropdown_users’, ‘cust_dropdown_users’); function cust_dropdown_users($output) { $users = get_users(); $output = “<select id=\”post_author_override\” name=\”post_author_override\” class=\”\”>”; //Leave the admin in the list $output .= “<option value=\”1\”>Admin</option>”; foreach ($users as $user) { $sel = ($GLOBALS[‘post’]->post_author == $user->ID) ? “selected=’selected'” : ”; $output .= ‘<option … Read more
WP_Query Order by Specific Post ID First
OK, After a lot of trial and error and asking around I managed to finally get a working solution. Thought I would post it here for those that are trying to fix a similar problem in the future. Filter 1: posts_join creates a left join on all queries to link up the postmeta table. Its … Read more
Okay thanks for all the helpful comments. It turns out there is no way to do this using WP_QUERY alone. The best way I can think of is to do it is like so: $taxIds = get_terms($options[‘post-types’][$this->current_post_type->name], array( ‘fields’ => ‘ids’, )); $uncategorisedQuery = new WP_Query( array( ‘post_type’ => $postType, ‘posts_per_page’ => -1, ‘tax_query’ => … Read more
tax_query OR with empty result returns all posts
there is no need to handle the pagination like this: $paged = get_query_var( ‘paged’, 1 ); Just put this after the loop: get_the_posts_pagination( ‘mid_size’ => 1, ‘prev_text’ => ‘ ’, ‘next_text’ => ‘ ’, ‘screen_reader_text’ => ‘A’ ) like this: if( have_posts() ){ while( have_posts() ){ the_post();?> the_content();?> <?php } echo get_the_posts_pagination( ‘mid_size’ => 1, ‘prev_text’ => … Read more
WP_Query’s “request” SQL Query