WordPress.org

Ready to get started?Download WordPress

Forums

Front-end Editor
[resolved] Disable on specific pages? (10 posts)

  1. modesix
    Member
    Posted 4 years ago #

    Is there a way to disable this plugin on a specific page or post? It seems to interfere with form elements, specifically form post method, so it is making my integrated forum unusable.

  2. scribu
    Member
    Plugin Author

    Posted 4 years ago #

    Try the development version (2.0-alpha3). It should not interfere with form controls anymore.

  3. altoidboy
    Member
    Posted 3 years ago #

    I need the exact same thing -- there's one page that FEE is allowing admins to edit from the front end that's causing problems, but I can't figure out how to defeat FEE on only that specific page. I followed the link above to the development version but it seems to lead to the public release version...any ideas?

  4. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    I hope you mean disable. "Defeat" sounds so confrontational. :P

    Just place this code in your theme's functions.php:

    function fee_disable( $allow, $args ) {
    	$disabled_post_ids = array( 101, 102 );
    
    	return $allow && !in_array( $args['post_id'], $disabled_post_ids );
    }
    add_filter('front_end_editor_allow_post', 'fee_disable', 10, 2);

    Of course, you have to replace 101, 102 with your own post id(s).

  5. altoidboy
    Member
    Posted 3 years ago #

    Thank you so much Scribu! I'll test that later today.

  6. CR
    Member
    Posted 3 years ago #

    I'm having a similar problem I think, I keep getting this error: Warning: Missing argument 2 for FEE_Field_Category::wrap() in filepath...etc.

    But it only happens on a few pages, all of which are using the TDO Mini Forms plugin to display a form. I'm sure that's the problem and simply want to disable front end editing on those pages. I added the code posted above to my functions file, but it doesn't do anything. Do I need to add an add_action or somehow call the function to make it work? If so, where and what variables am I passing in?

    Thanks!

  7. CR
    Member
    Posted 3 years ago #

    Okay, found another way to do what I want. I found this post on the plugin website: http://scribu.net/wordpress/front-end-editor/loading-only-on-certain-pages.html

    Made a slight modification to the code given there and it works great for my purposes:

    function front_editor_disable() {
    if ( is_page() )
    return true;
    }
    add_filter('front_end_editor_disable', 'front_editor_disable');

    Since all the problem areas of my site are pages rather than posts. Would still love be able to pick specific posts / pages, but this works fine for me for now. Thanks!

  8. fredellini
    Member
    Posted 3 years ago #

    close, this one works for me with the latest version like a charm:

    function front_editor_disable() {
    if ( is_page(*pageid*) )
    return true;
    }
    add_filter('front_end_editor_disable', 'front_editor_disable');

    or can you use a custom field to fill in the page id?
    best regards!

  9. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    or can you use a custom field to fill in the page id?

    You can do something like this:

    Disable Front-end Editor if the current page has a 'fee_disable' custom field:

    function front_editor_disable() {
      global $wp_query;
    
      if ( is_page() && get_post_meta($wp_query->posts[0]->ID, 'fee_disable', true) )
        return true;
    }
    add_filter('front_end_editor_disable', 'front_editor_disable');
  10. fredellini
    Member
    Posted 3 years ago #

    thanky you scribu - this is awesome!

    this snippet works for posts too:

    function front_editor_disable() {
    global $wp_query;
    if ( is_page() && get_post_meta($wp_query->posts[0]->ID, 'fee_disable', true) )
    return true;
    if ( is_single() && get_post_meta($wp_query->posts[0]->ID, 'fee_disable', true) )
    return true;
    }
    add_filter('front_end_editor_disable', 'front_editor_disable');

    whenever the custom field is "true" no editing is possible.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic