WordPress.org

Ready to get started?Download WordPress

Forums

Wrong # of posts in Admin (custom post type) (1 post)

  1. Erik
    Member
    Posted 2 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic