In a current project I need to be able to restrict access to posts by comparing the post's language against the languages a user has access to. This, I'm certain I can achieve.

However, even if a user should not be allowed to edit the post the user should be able to view the post in the administration area. The reason for this is to be able to use the localization plugin's duplicate/translate actions. And also so the user can just compare information or read from another language.

The problem now is that the cap I'm interested in (edit_post) is used both to access the edit page and also to the actual saving of the post.

When using one of the filters map_meta_cap or user_has_cap no real context is passed except the post ID. So I can't really prevent just the post save while allowing the edit page to still be accessible.

Is there a way to allow a role to access/view an edit post page in the administration and still disallow actual save actions?

I would prefer not to try to figure out the context by going through the backtrace with debug_backtrace().

1 Answer 1


How about remove_meta_box( $id, $page, $context );? https://codex.wordpress.org/Function_Reference/remove_meta_box

This will remove the Publish meta box which contains the save button...

    function disable_save()    {
        if( !current_user_can( 'edit_post' ) )   { // Or whatever check you need to make
            remove_meta_box( 'submitdiv', 'your-chosen-post-type', 'side' );
    } // disable_save
    add_action( 'admin_menu', 'disable_save' );
  • That does it! Another approach to the problem but whatever works I guess :) Cheers!
    – hampusn
    Commented Aug 19, 2015 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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