0

I have some pages with shortcodes and I don't want my client to see the pages with shortcodes. Is there a way to hide these pages under Pages-->All Pages,but should be seen under Menu.Is there a plugin to achieve this?I have searched but found none.

  • What do you mean by seen under the menu? Please explain a bit more. – sri Nov 26 '13 at 10:44
2

I used the following code snippet into one of my project. Use the code snippet into the functions.php within the main PHP tag:

// HIDE SOME PAGES FROM THE EYE OF EDITOR

function wpse20131126_exclude_pages_from_admin($query) {
    global $pagenow, $post_type;
    if (is_admin() && current_user_can('editor') && $pagenow=='edit.php' && $post_type =='page') {
        $query->query_vars['post__not_in'] = array(
                        '77', // the security page
                        '74', // the shortcoded page
                        '111' // the abracadabra page
                        );
    }
}

add_filter( 'parse_query', 'wpse20131126_exclude_pages_from_admin' );

Add your pages inside the array to hide from the eye of User role 'Editor'.

Your Answer

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

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