WordPress.org

Ready to get started?Download WordPress

Forums

pre_get_posts() breaking permalinks (2 posts)

  1. trunham
    Member
    Posted 7 months ago #

    Hey guys,

    The exact code is:

    function search_filter($query) {
      if ( !is_admin() && $query->is_main_query() ) {
         $query->set('post_type', array( 'post' ) );
      }
    }
    add_action('pre_get_posts','search_filter');

    This appears to break all of my page links except for one which re-directs to a post for some reason. It happened after updating to 3.8 although i guess the code could be wrong too. Any help would be much appreciated!

    Thanks

  2. Gary
    Member
    Posted 6 months ago #

Reply

You must log in to post.

About this Topic