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.

Is there a way to disable the sticky option on posts in specific categories?

share|improve this question
1  
Maybe, yes. What did you find in your research? –  brasofilo Jan 22 '13 at 22:35
    
Nothing, that's the problem. I keep getting pages of irrelevant search results. –  Force Flow Jan 23 '13 at 14:32
    
Maybe there's nothing more to say about it, but I find strange a one line Question with the_title == the_content... Much probably this is a jQuery solution, I've answered quite a few. And an inside research on Sticky Posts. –  brasofilo Jan 23 '13 at 14:45

1 Answer 1

up vote 0 down vote accepted

I ended up going with another approach. I check to see what the current user's role is, then if the role is 'author', enqueued a CSS file to hide the sticky option's checkbox.

In the theme's functions.php file:

function hide_sticky_option($hook) {
    global $current_user;

    if('post.php'== $hook || 'post-new.php'==$hook){
        $role = array_shift($current_user->roles); //get role of current user
        if($role=='author'){ //if role of current user is 'author'
            wp_enqueue_style('hide_sticky_option', get_template_directory_uri() . '/css/admin-post-style.css' );
        }
    }
}
add_action( 'admin_enqueue_scripts', 'hide_sticky_option' );

admin-post-style.css:

#sticky-span {
    display:none !important;
}
share|improve this answer

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.