How can I change arguments for the main query only, and not affect other queries? add_filter('pre_get_posts', 'custom_post_count'); function custom_post_count($query){ $query->set('posts_per_page', 5); return $query; }; Because this action is called...
We are experiencing very slow performance with queries that use SQL_CALC_FOUND_ROWS within the admin section of WordPress. We currently have about 125,000 posts on our site and use Varnish...
I have function like this: //sorting archive query by pinned posts function archive_sort_pinned($query){ $option = get_option('hsa_story_cats'); $current_category = get_queried_object(); if(!is_admin() && $query->is_main_query() && is_category($option)){ $query->set('meta_query', array( 'relation' => 'OR',...
i have a custom post type project the url that worked out of the box was: www.myapp.com/project/POST-ID and www.myapp.com/project/POST-SLUG now my client needs the url be available in the...
I pre get posts for a events archive page: http://www.netzwerk-leipziger-freiheit.de/veranstaltungen/ function my_pre_get_posts( $query ) { // do not modify queries in the admin if( is_admin() ){ return $query; }...
I’m almost there on this one. On functions.php i have this: function base_home_product_post_type( $query ) { if($query->is_search() && $_POST['box'] == 'sku') { $query->query_vars['post_type'] = 'product'; $query->query_vars['meta_key'] = 'sku'; $query->query_vars['meta_value']...
I’m assigning some posts to some users whom are not the author of those posts. Typically private posts are visible only to the post authors. So, if the author...
I have a multisite network of sites which should display blog content from each other if the blog post has a tag with the site name. To gather all...
Im using the pre_get_posts hook to customize my query for a custom post type archive. Some of the posts for this custom post type have a meta key mp_micropub_accredited...
I’d like to show more posts on my custom archive page, but can’t seem to figure out the right way to do it. Currently it displays 10, which is...