Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
205 views
in Technique[技术] by (71.8m points)

php - remove_meta_box wordpress function doesn't exists

I'm trying to remove category meta box from post. I've always error :

Fatal error: Uncaught Error: Call to undefined function remove_meta_box()

When i Try the following code, that display "No cool"

if (function_exists( 'remove_meta_box' ) ) {
    die('cool');
}else{
    die('No cool');
}

I deduce remove_meta_box function doesn't exist ?

I've try the following code

function remove_my_post_metaboxes() {
    remove_meta_box('categorydiv’','post','side');
}
 add_action('admin_head','remove_my_post_metaboxes');

But it not working too. I'm working with wp 5.5. I think there is nicer solution than display:none in CSS

question from:https://stackoverflow.com/questions/65832518/remove-meta-box-wordpress-function-doesnt-exists

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...