How to Include Custom Post in WordPress Author Archive Page

Community Member
Posted on 3 weeks agoIs your WordPress theme not showing custom post on Author Archive page? Add the following code snippet to functions.php
file. This WordPress hook will include custom post types in WordPress Author archive page.
//include snippet in author archive template function custom_archive_query( $query ) { if ( is_author() && $query->is_main_query()) { $query->set( 'post_type', array( 'post', 'deals' , 'books' ) ); } return $query; } add_filter( 'pre_get_posts', 'custom_archive_query' );
Related posts
- How to use custom CSS in Redux framework option panel
- How to Add Font Awesome Icons to Redux Options Panel
- WordPress.com vs WordPress.org: Which One to Choose?
- WordPress Page Not Found 404 Page Template Sample
- Limit Archive Page Content with Read More Link in WordPress
- How to List All the Categories for Custom Post Type