Support » Plugins » [Plugin: Front-end Editor] allow editing only for certain category

  • Hi, I’d like to make a “wiki” section in my blog, and only “wiki” category post have to be editable, and not for the rest of my blog post.

    How can I resolve my problem?
    I’ve read the previous thread and tried different solutions, but all thread were related to previous plugin version
    many thanks for attention

    marco

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hm… this topic didn’t have the front-end-editor tag for some reason. That’s why I missed it.

    Here’s the updated code:

    function fee_specific_category( $allow, $args ) {
    	return $allow && in_category( 'wiki', $args['post_id'] );
    }
    add_filter( 'front_end_editor_allow_post', 'fee_specific_category', 10, 2 );

    See in_category() for more info.

    works! perfect!
    many many thanks!
    marco

    Sorry, can you tell me where you have to place this code?

    I think I have a similar problem:

    I’d like to make a “wiki” section in my blog, and only “wiki” pages have to be editable, and not for the rest of my blog. All my “wiki” pages have a custom file named “wiki”.

    How can I resolve my problem?

    grazie!

    Fabio

    You have to place the code inside your functions.php file.

    For restricting based on a custom field it would be:

    function fee_specific_custom_field( $allow, $args ) {
    	return $allow && get_post_meta( $args['post_id'], 'wiki', true );
    }
    add_filter( 'front_end_editor_allow_post', 'fee_specific_custom_field', 10, 2 );

    Note that this will still require users to be logged in and have the ‘edit_pages’ capability.

    All works!
    Thank you!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Front-end Editor] allow editing only for certain category’ is closed to new replies.