WordPress.org

Support

Support » Plugins and Hacks » [Resolved] A way to hide a page in admin panel ONLY

[Resolved] A way to hide a page in admin panel ONLY

  • sup everybody, is there a way I can tailor the control panel pages only for my client?

    For example, I have a blog page on the site… but the blog page is fed from posts… in the post section. I want to remove the “Blog” page just from the Pages section so not to confuse my client…

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Exclude page with the ID 23 from the edit pages list.

    add_action( 'pre_get_posts' ,'exclude_this_page' );
    function exclude_this_page( $query ) {
    	if( !is_admin() )
    		return $query;
    
    	global $pagenow;
    
    	// WordPress 2.9
    	if( 'edit-pages.php' == $pagenow )
    		$query->set( 'post__not_in', array(23) );
    
    	// WordPress 3.0
    	/*
    	if( 'edit.php' == $pagenow && ( get_query_var('post_type') && 'page' == get_query_var('post_type') ) )
    		$query->set( 'post__not_in', array(23) );
    	*/
    	return $query;
    }

    23 is of course an example ID, adjust as necessary..

    NOTE: This doesn’t stop the post being editable if you know the ID, it’s just hidden from the page listing (i assumed that’s what you want though).

    Ah, cool. Thanks much!

    You’re welcome.. 🙂

    Is there any way to do this for all users EXCEPT administrator? Thanks!

    Is this added in functions.php?

    Moderator Bet Hannon

    @bethannon1

    Support Team Volunteer Wrangler

    I’m assuming that this is added in the functions.php file, right?

    And will I have to re-add it everytime I update or change themes?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] A way to hide a page in admin panel ONLY’ is closed to new replies.
Skip to toolbar