Forums

Custom Field Template
disable metabox in other pages (3 posts)

  1. luiggiggi
    Member
    Posted 1 year ago #

    hi,

    i'm using this wonderful plugin for my site but i can't completely remove the custom template metabox from other page than the one i want.

    I set the Id post to the one of my page (2) and the plugin shows correctly the custom fields in that page but leaves an empty metabox to the others.

    i've try also whith

    add_action('admin_menu','remove_metabox');
    
    function remove_metabox(){
         if (!is_page(2)):
         remove_meta_box( 'cftdiv' , 'page' , 'normal' );
         endif;
    }

    but the box is removed from all the pages.

    how can i afford this problem?

    thank you!

  2. WebEndev
    Member
    Posted 1 year ago #

    I would also like to know how to do this.

  3. proximity2008
    Member
    Posted 1 year ago #

    For Munman's benefit:

    I'm not sure if you can use is_page in the admin area like that.

    Anyway I'd use the $_GET parameters to check what page you're on so:

    add_action('admin_menu','remove_metabox');
    
    function remove_metabox(){
         if ( $_GET['post'] != 2 ):
         remove_meta_box( 'cftdiv' , 'page' , 'normal' );
         endif;
    }

    That should do the trick.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic