1

I want to remove some metaboxes, that was added to page edit.php by thridparty plugins. I insert this code into functions.php:

function vpm_remove_meta_box() {
        remove_meta_box( 'ortext-metabox', 'post', 'normal' );
        remove_meta_box( 'ez-toc', 'post', 'normal' );
}
add_action( 'add_meta_boxes', 'vpm_remove_meta_box' );

But, it don't working. I found that plugins register this metaboxes with function:

add_meta_box('ortext-metabox', OrTextBase::NAME_SERVIC_ORIGINAL_TEXT, array($this, 'metabosHtml'), "$v", 'side', 'high');
add_meta_box( 'ez-toc', esc_html__( 'Table of Contents', 'ez-toc' ), array( $this, 'displayMetabox' ) );

How i can get it done?

1 Answer 1

0

You can use the do_meta_boxes hook to remove the metaboxes instead.

Like below

add_action( 'do_meta_boxes', 'vpm_remove_meta_box' );
function vpm_remove_meta_box() {
    remove_meta_box( 'ortext-metabox', 'post', 'normal' );
    remove_meta_box( 'ez-toc', 'post', 'normal' );
}

See this for more info

https://developer.wordpress.org/reference/functions/remove_meta_box/

4
  • Thanks, but it do not working too. I heared, that hock admin_menu executes too early for plugins. Nov 9, 2017 at 16:57
  • Sorry about that ! I have updated the code and the wrong link. Looks like do_meta_boxes is the way to go
    – LumberHack
    Nov 10, 2017 at 11:14
  • Did this work ?
    – LumberHack
    Nov 12, 2017 at 8:51
  • No, it didn't work. Nov 17, 2017 at 11:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.