Support » Fixing WordPress » Users posts not showing up on user page

  • Resolved Matt25


    Hi, I have created a test user for the site I am building to check everything is working, but it isn’t.

    I have created a new user role called musicians that can only post in the Music post type. After logging in on the test user and posting a new post, the post isn’t showing up on the Musicians page.
    Basically on the musicians page I am trying to fetch all posts by that user, but even though in the backend the post says it was made by the test user, the page says the user has no posts. The post count in the list of users also still displays 0.

    Is there some thing I could have missed while creating the post type or user roles that is preventing new posts from being registered properly, or is there a bug I haven’t found.

    I have been searching for a long time now and I really hope someone can help.

    Thanks in advance,

Viewing 4 replies - 1 through 4 (of 4 total)
  • Sounds as though you are using one of the members plugins. Please post your question in that plugin’s support forum.

    Thanks for the reply. I am not using any member plugins.
    I have been changing some things and it seems it is only when I post into a custom post type that it doesn’t show as a post. When I post a standard post it works fine.

    Is there something I missed when setting up the custom post types?

    register_post_type( 'musicp',
    			'labels' => array(
    				'name' => __( 'Music' ),
    				'singular_name' => __( 'Music' )
    		'taxonomies' => array('category'),
    		'public' => true,
    		'has_archive' => true,
    		'supports' => array( 'title', 'author','editor', 'thumbnail', 'custom-fields' )


    I have found that custom post types don’t show in queries automaticly thanks to

    I have added the ‘$query->is_page_template’ part to try and get it to show on the page template, I am not sure if this is right or not but it is not working.

    function custom_post_author_archive($query) {
        if ($query->is_author || $query->is_page_template )
            $query->set( 'post_type', array('musicp', '3dill', 'post') );
        remove_action( 'pre_get_posts', 'custom_post_author_archive' );
    add_action('pre_get_posts', 'custom_post_author_archive');

    Just to clarify and simplify. I have a page which fetches all users of a certain role and then displays their posts(which are custom post types). When I add a post that is a custom post type it does not display as part of the users posts, nor does it show in the post count on the users table.

    Any help would be much appreciated.


    Solved, Just added my custom post type to WP_Query 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Users posts not showing up on user page’ is closed to new replies.