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.

I need to make posts not editable by non-admins in the backend, is there a way to disable the link in the title of the posts when they view the list of post published? Thanks!

share|improve this question
    
Modify capabilities using a plugin such as Members. –  vancoder Apr 3 '13 at 22:16
    
This project is meant to be the standard for al my upcoming websites and I'd rather prefer to continue to add new functions to functions.php instead of installing plugins (with the risk that any new update coul compromise the site or having conflicts with another...). Up to now I've been able to add all my edit through functions.php and this is the reason for seeing if it's possible to have a sort of code... –  user27309 Apr 4 '13 at 10:43

1 Answer 1

I believe the links below achieve what you're looking to do when they're combined. If you want to have administrators or just specific admin IDs excluded you could add to the if statement in the function like I have done with current_user_can function;

function perm($return, $id, $new_title, $new_slug){
    global $post;
    if($post->post_type == 'testimonials' && current_user_can('manage_options'))
    {
        $ret2 = preg_replace('/<span id="edit-slug-buttons">.*<\/span>|<span id=\'view-post-btn\'>.*<\/span>/i', '', $return);
    }

    return $ret2;
}
if ( is_user_logged_in() ){
    add_filter('get_sample_permalink_html', 'perm', '',4);
}

I have not tested this.

Removing Edit Permalink/View "Custom Post Type" areas

How to check if a WordPress user is an “administrator”

share|improve this answer
    
Haven't tested, but there's an error: change both occurrences of $ret2 to $return. If the condition is not met, you are returning a null variable. –  brasofilo Apr 8 '13 at 15:04

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.