Archived topic
Missing Author Archive
5 replies · Started by Michael on March 5, 2022
Hi,
I think there should be a default author archive on the site, showing all related pages? Seems like I dont have that. When I click on my author profile link I cant see any pages related to the author.
Can you please have a look at my site? Alternatively tell me how to set one up?
Thanks
Hi there,
can you try rebuilding your Permalinks by going to Dashboard > Settings > Permalinks and clicking Save Changes.
Hi David,
thanks, did that but it didnt change anything unfortunately.
Aah their Pages not Posts
By default WP will only ouput posts in the loop.
You can try enabling them by adding this PHP Snippet to your site:
function db_inc_pages_in_loop( $query ) {
if ( $query->is_main_query() && ! is_admin() && is_author() && empty( $query->query_vars['suppress_filters'] ) ) {
$query->set( 'post_type', array( 'post', 'page' ) );
}
}
add_action( 'pre_get_posts', 'db_inc_pages_in_loop' );
Adding PHP:
https://docs.generatepress.com/article/adding-php/
that did it, thanks a lot David!
You're welcome