• Hi currently, when I go to my aurtho page it is only displaying Posts and not Pages written by an author. Do do I enable both Pages and Posts authored by an author to show in the author archive page?

Viewing 1 replies (of 1 total)
  • Try the following entry in the functions.php of your child theme, via your own plugin or a code snippet plugin:

    add_action( 'pre_get_posts', function( $query ) {
        if ( ! $query->is_main_query() || is_admin() ) {
            return;
        }
    
        if ( $query->is_author ) {
            $query->set( 'post_type', array( 'post', 'page' ) );
        }
    } );
Viewing 1 replies (of 1 total)
  • The topic ‘Display Pages not just Posts on author archive page’ is closed to new replies.