0

How I can allow only specific users to edit specific pages? With code or the Groups plugin (by itthinx), Im not allowed to use another plugin. Is that possible?

I ended up to this solution:

add_filter( 'parse_query', 'atz_hide_pages_in_wp_admin' );
function atz_hide_pages_in_wp_admin($query) {
    global $pagenow,$post_type; 
    if (!current_user_can('administrator') && wp_get_current_user()->user_login == 'USR1' && $pagenow=='edit.php' && $post_type =='page') {
        $query->query_vars['post__not_in'] = array('51', '2552' );
    }
}

Its not the perfect solution because page ids are hardcoded.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.