• Resolved talleragencia

    (@talleragencia)


    Hello, I have created a type of content and I have users to create entries in that type of content, when I click on the author’s profile page it does not show it, because it does not recognize the entries of the content type.

Viewing 1 replies (of 1 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Hi @talleragencia

    For the moment, I am going to assume you are referring to your given post types not appearing in a given user/author’s archive

    Something like this should help. It’d go in your active theme’s functions.php file

    function my_cptui_add_post_types_to_archives( $query ) {
    	// We do not want unintended consequences.
    	if ( is_admin() || ! $query->is_main_query() ) {
    		return;    
    	}
    
    	if ( is_author() empty( $query->query_vars['suppress_filters'] ) ) {
    		$cptui_post_types = cptui_get_post_type_slugs();
    
    		$query->set(
    			'post_type',
    			array_merge(
    				array( 'post' ),
    				$cptui_post_types
    			)
    		);
    	}
    }
    add_filter( 'pre_get_posts', 'my_cptui_add_post_types_to_archives' );

    This will merge in all content types registered with CPTUI into the post types considered for the author archive.

Viewing 1 replies (of 1 total)
  • The topic ‘author custom post type’ is closed to new replies.