CPTs not related to authors
-
Hi, we’ve enjoyed the CPT UI plugin for creating “artists” profile posts.
Artists have been setup as authors and assigned to their pages; however, when they log in to view and edit their pages, they are not there even though under the “artists” CPT view, we can see their names as authors.
I have been testing snippets of code hoping to solve this issue without success. Including this:
// /* pre_get_posts function added to include post type blog in author loop */
function add_cpt_author( $query ) {
if ( !is_admin() && $query->is_author() && $query->is_main_query() ) {
$query->set( ‘post_type’, array(‘post’, ‘artists’ ) );
}
}
add_action( ‘pre_get_posts’, ‘add_cpt_author’ );When I move the CPT from “artists” to a regular blog post using Post Type Switcher plugin, the posts do appear under authors and are accessible via backend.
Any help solving this would be greatly appreciated.
The page I need help with: [log in to see the link]
- The topic ‘CPTs not related to authors’ is closed to new replies.