Hide a page in the admin end without a plugin?

you can use parse_query filter hook to exclude your pages using post__not_in attribute

add_filter( 'parse_query', 'exclude_pages_from_admin' );
function exclude_pages_from_admin($query) {
    global $pagenow,$post_type;
    if (is_admin() && $pagenow=='edit.php' && $post_type =='page') {
        $query->query_vars['post__not_in'] = array('21','22','23');
    }
}

this will exclude pages with the ids of 21,22,23

and to make sure this pages will not be included on the front end using wp_list_pages
you can use wp_list_pages_excludes filter hook:

 add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages');
 function exclude_from_wp_list_pages($exclude_array){
    $exclude_array = $exclude_array + array('21','22','23');
    return $exclude_array;
 }

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)