WordPress.org

Ready to get started?Download WordPress

Forums

Manage Your Posts Only (3 posts)

  1. Pete
    Member
    Posted 3 years ago #

    makes it so that users and editors can only see posts from the manage tab that they have written themselves. By using this plugin, the only users that can see all posts from the manage tab are Admins.

    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' );
  2. Patoncho
    Member
    Posted 3 years ago #

    I'm new to WP: where should I locate this code?

    I've tried in the Plugins folder, but with no success.. Could you help me out here?

    Thanks!

  3. John O
    Member
    Posted 3 years ago #

    Hi,

    Try sticking it in functions.php in your theme folder.

    John

Topic Closed

This topic has been closed to new replies.

About this Topic