Skip to main content
2 of 2
replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/

I have written a quite extensive post on a similar subject that you can read here. Also take your time and read all linked posts.

In there I have explained why you should not be using query_posts and why you should not use custom queries in place of the main query

A few things here:

  • Remember to create a child theme, do not make changes to a theme that you have not written. You will loose all your work if you update that theme

  • It is real easy to create your own author archive page. Simply make a copy of your index.php and rename it author.php. It is that easy

  • Use pre_get_posts to make changes to your author page. Do not make changes directly through a custom query on your author page. You can use the following in your functions.php

      function wpse166864_include_category( $query ) {
          if ( !is_admin() && $query->is_author() && $query->is_main_query() ) {
             $query->set( 'cat', '1' );
          }
      }
      add_action( 'pre_get_posts', 'wpse166864_include_category' );
    
Pieter Goosen
  • 55.4k
  • 23
  • 115
  • 209