Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

For some reason the slug / permalink meta box is not being removed on the Edit Page screen.

Code in functions.php

function mjp_edit_meta_boxes() {

    // Remove Meta Boxes
    remove_meta_box( 'commentsdiv', 'page', 'normal' ); // Works
    remove_meta_box('slugdiv', 'page', 'normal'); // Fails?

}

add_action( 'add_meta_boxes', 'mjp_edit_meta_boxes' );

Update:

These are the hooks I've tried:

add_action( 'add_meta_boxes', 'mjp_edit_meta_boxes', 1 );  
add_action( 'add_meta_boxes', 'mjp_edit_meta_boxes', 999 );  
add_action( 'admin_menu', 'mjp_edit_meta_boxes', 1 );  
add_action( 'admin_menu', 'mjp_edit_meta_boxes', 999 );  
share|improve this question
1  
Your exact code works for me... Try two variations of priority add_action('add_meta_boxes', 'callback', 1); and 999 instead of 1. Otherwise, full troubleshoot. –  brasofilo Jan 3 '13 at 3:58
    
Is there anyway of instead of hiding it, showing it but stop it from being edited? –  ptimson Jan 3 '13 at 11:20
    
Hid with CSS for now –  ptimson Jan 3 '13 at 15:16

1 Answer 1

I ran into this issue recently on a site that I was modifying for a client. The solution that worked for me was to set a ridiculously high priority for my action hook, like so:

add_action( 'add_meta_boxes', 'mjp_edit_meta_boxes', 999 );

This ensures that the action is executed at the very end of the chain after all of the meta boxes have registered.

Update:

If this isn't working for you, trying hooking into another action such as admin_menu.

add_action( 'admin_menu', 'mjp_edit_meta_boxes' );
share|improve this answer
    
Thanks, Unfortunately this doesn't work either :( –  ptimson Jan 3 '13 at 3:42
    
I tried that and add_action( 'admin_menu', 'mjp_edit_meta_boxes', 999 ); with no success. So weird! Im on WordPress 3.5 if they've updated something? –  ptimson Jan 3 '13 at 3:57
    
Either method works for me in 3.5. –  Joseph Jan 3 '13 at 4:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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