WordPress.org

Ready to get started?Download WordPress

Forums

Front-end Editor
[resolved] edit only custom post types (3 posts)

  1. Mr Papa
    Member
    Posted 3 years ago #

    Is it possible to limit user editing to a specific couple of custom post types?

  2. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    Yes, by adding this code in your functions.php file:

    function fee_restrict_post_types( $allow, $data ) {
    	$allowed_post_types = array( 'page', 'foo' );
    
    	$current_post_type = get_post_type( $data['post_id'] );
    
    	return $allow && in_array( $current_post_type, $allowed_post_types );
    }
    add_filter( 'front_end_editor_allow_post', 'fee_restrict_post_types', 10, 2 );

    Obviously, change $allowed_post_types to what you need.

  3. Mr Papa
    Member
    Posted 3 years ago #

    Thanks Scribu - works great of course...

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic