• Resolved polyfade

    (@polyfade)


    This seems to fail when using pre_get_posts to modify the loop.

    
    function target_main_category_query_with_conditional_tags( $query ) {
     if ( ! is_admin() && $query->is_main_query() ) {
      if ( is_post_type_archive('location') ) {
    			
       $query->set( 'posts_per_page', -1 ); 
       $query->set( 'orderby', 'name' );
       $query->set( 'order', 'ASC' );
        }
      }
    }
    
    add_action( 'pre_get_posts', 'target_main_category_query_with_conditional_tags' );
    
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Does not work with pre_get_posts’ is closed to new replies.