By default, WordPress only includes ‘posts’ in the Author Archive. To fix this, you need to modify the pre_get_posts
filter to accommodate for your missing post types.
1 2 3 4 5 6 7 8 9 10 11 |
function post_types_author_archives($query) { // Add ‘videos’ post type to author archives // Add your own Post types in single quotes before 'post' if ( $query->is_author ) { $query->set( 'post_type', array('videos','post') ); // Remove the action after it’s run remove_action( 'pre_get_posts', 'post_types_author_archives' ); } } add_action( 'pre_get_posts', 'post_types_author_archives' ); |