WordPress.org

Support

Support » Plugins and Hacks » Hacks » Wrong # of posts in Admin (custom post type)

Wrong # of posts in Admin (custom post type)

  • Hi,

    I have a custom post type. And have given the subscriber following capabilities

    $role_object->add_cap( 'read_customposttype' );
    $role_object->add_cap( 'edit_customposttype' );
    $role_object->add_cap( 'publish_customposttype' );
    $role_object->add_cap( 'delete_customposttype' );

    This works perfectly. I also have following edit.php hack:

    function mypo_parse_query_useronly( $wp_query ) {
        if ( strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/edit.php' ) !== false ) {
            if ( !current_user_can( 'level_10' ) ) {
                global $current_user;
                $wp_query->set( 'author', $current_user->id );
            }
        }
    }
    add_filter('parse_query', 'mypo_parse_query_useronly' );

    This also works perfectly. But there is an issue regarding number of posts in edit.php in admin panel. This number shows the total of all posts. I want to show the number of posts for owner only.

    Somebody can help me? Is there anything else you need to know about my code?

  • The topic ‘Wrong # of posts in Admin (custom post type)’ is closed to new replies.
Skip to toolbar