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?

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 '17 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 '17 at 11:14
  • Did this work ? – LumberHack Nov 12 '17 at 8:51
  • No, it didn't work. – Сергей Матийчук Nov 17 '17 at 11:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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