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 want to create a handful of pages that I do not want the client to have access to through the edit pages admin screen.

I do want the pages to have all the normal functionality of pages in other parts of the control panel. For example, I want the pages to show on... Appearance > Menus ...so the client can reorder or rename them in the navigation.

I found a question that almost had the perfect solution...

Create a page without adding a page in the Database

The answer was great - it forces the use of a template based on a key=>value pair in the URL, which means the "page" can exist without actually creating a page. The downside is that it doesn't behave like a page in other places (ex: not a custom menu option as mentioned above) because its not actually a page.

The ideal solution for me would be to create a real page and filter it out when the Edit Pages screen is loaded, but I'm not sure how to do that.

I'm open to completely different approaches, but if a custom page template is any part of the solution then the solution also needs to remove the page template as an option from the drop-down when editing other pages, so that the client can't replicate these pages.

Thanks in advance for the help. ~ Kirkland

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

Indeed there is a way.

function wpa53074_admin_exclude_page( $query ) {
    if( !is_admin() )
        return $query;

    global $pagenow;
    if( 'edit.php' == $pagenow && 'page' == get_query_var( 'post_type' ) )
        $query->set( 'post__not_in', array( 99 ) ); // <- page ID to hide

    return $query;
}
add_action( 'pre_get_posts', 'wpa53074_admin_exclude_page' );
share|improve this answer
    
You sir, ROCK! Thank you! –  Kirkland May 23 '12 at 19:56
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.