WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I don't want to show the permalink if the user is subscriber. Can anyone help me to achieve that?

PS: I'm talking about the permalink which appears below title while creating new post.

PPS: I modified the rules for subscriber. They can able to submit the post for review

share|improve this question
Subscribers cannot create new posts. Are you talking about the contributor role? – Brian Fegter Feb 8 '12 at 17:26
No i modified the rules for subscriber. They can able to submit the post for review – Giri Feb 8 '12 at 17:39
Please notate that in your question as it innately will cause some confusion with the out-of-the-box role permissions. – Brian Fegter Feb 8 '12 at 17:50

maybe this can do the trick? (untested). Note I used contributor role (Thanks to Brian Fegter for pointing this out)

function my_remove_meta_boxes() {
    if (current_user_can('contributor')) {
        remove_meta_box('slugdiv', 'post', 'normal');
add_action( 'admin_menu', 'my_remove_meta_boxes' );
share|improve this answer
Hi i think hook will be do_meta_boxes instead of admin_menu – Giri Feb 8 '12 at 17:45
ok, just used another example from somewhere without testing it. If you say that's working then I'd update the answer for future reference. – Yoav Aner Feb 8 '12 at 17:51
No i guess you are right. So don't change anything – Giri Feb 8 '12 at 18:17
Hi the code you given is to hide slug metabox. Not that permalink edit box. Let me post the answer – Giri Feb 8 '12 at 18:34
up vote 2 down vote accepted
function hide_slug_box() {
    global $post;
    global $pagenow;
    if (is_admin() && $pagenow=='post-new.php' OR $pagenow=='post.php') {
        echo "<script type='text/javascript'>
            jQuery(document).ready(function($) {
add_action( 'admin_head', 'hide_slug_box'  );
share|improve this answer
Just wondering why you accepted the previous answer, then posted your own answer. Which answer is correct? – Brian Fegter Feb 8 '12 at 19:26
Actually i thought Yoav Aner answer is right. So i accepted it. But when i try it, it actually removes slug metabox which is wrong. So i posted the new answer. My answer is right and its working. But i need to wait 2 days to accept my answer – Giri Feb 8 '12 at 19:35
@Virthagirl ahh I see. :) – Brian Fegter Feb 8 '12 at 20:36

i think it is better to use css than to use jQuery to hide the element...

instead of the script part i use

 echo "<style>
       #edit-slug-box {display:none!important}
share|improve this answer

Your Answer


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.