Title: Error 500 with remove_meta_box
Last modified: August 20, 2016

---

# Error 500 with remove_meta_box

 *  Resolved [ntoqiakt](https://wordpress.org/support/users/ntoqiakt/)
 * (@ntoqiakt)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/error-500-with-remove_meta_box/)
 * Hi,
 * I have a weird problem. I’m building a site and I wanted to get rid of some meta
   boxes from the UI so I used the following code:
 *     ```
       if ( !current_user_can('manage_options') ) {
       	remove_meta_box( 'tagsdiv-post_tag', 'post', 'normal' );
       	remove_meta_box( 'formatdiv', 'post', 'normal' );
       	remove_meta_box('linkxfndiv', 'link', 'normal');
       	remove_meta_box('linkadvanceddiv', 'link', 'normal');
       }
       ```
   
 * It was working just fine until I deactivated the ‘All video gallery’ plugin. 
   After this whenever I use any of the above calls to the remove_meta_box function
   I get an Error 500.
 * I’ve tried deactivating all installed plugins with no joy. I’ve activated and
   deactivated (and even uninstalled and re-installed) ‘All video gallery’ plugin
   but the problem persists.
 * Does anyone know why this might be happening? Any help would be greatly appreciated.
 * T

Viewing 1 replies (of 1 total)

 *  Thread Starter [ntoqiakt](https://wordpress.org/support/users/ntoqiakt/)
 * (@ntoqiakt)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/error-500-with-remove_meta_box/#post-3200153)
 * So, it seems it was a fluke that the above code worked!!
 * Here’s what actually works (and added a couple of metaboxes too):
 *     ```
       function my_remove_meta_boxes() {
       	if(!current_user_can('administrator')) {
       		remove_meta_box( 'tagsdiv-post_tag', 'post', 'normal' );
       		remove_meta_box( 'formatdiv', 'post', 'normal' );
       		remove_meta_box( 'authordiv', 'post', 'normal' );
       		remove_meta_box( 'postcustom', 'post', 'normal' );
       		remove_meta_box( 'trackbacksdiv', 'post', 'normal' );
       		remove_meta_box( 'linkxfndiv', 'link', 'normal');
       		remove_meta_box( 'linkadvanceddiv', 'link', 'normal');
       	}
       }
       add_action( 'admin_menu', 'my_remove_meta_boxes' );
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Error 500 with remove_meta_box’ is closed to new replies.

## Tags

 * [error 500](https://wordpress.org/support/topic-tag/error-500/)
 * [remove_meta_box](https://wordpress.org/support/topic-tag/remove_meta_box/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [ntoqiakt](https://wordpress.org/support/users/ntoqiakt/)
 * Last activity: [13 years, 5 months ago](https://wordpress.org/support/topic/error-500-with-remove_meta_box/#post-3200153)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
