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 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.

share|improve this question
    
What do you mean by seen under the menu? Please explain a bit more. –  sri Nov 26 '13 at 10:44
add comment

1 Answer

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'.

share|improve this answer
add comment

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.