| | 102 | * Prevent specific pages (eg 'Activate') from showing in the Pages meta box of Administration Menu screen. |
| | 103 | * |
| | 104 | * @since BuddyPress (2.0) |
| | 105 | * |
| | 106 | * @uses bp_is_root_blog() checks if current blog is root blog. |
| | 107 | * @uses buddypress() gets BuddyPress main instance |
| | 108 | * |
| | 109 | * @param object $object The post type object used in the meta box |
| | 110 | * @return object The $object, with a query argument to remove register and activate pages id. |
| | 111 | */ |
| | 112 | function bp_core_exclude_pages_from_nav_menu_admin( $object = null ) { |
| | 113 | |
| | 114 | // Bail if not the root blog |
| | 115 | if ( ! bp_is_root_blog() ) |
| | 116 | return $object; |
| | 117 | |
| | 118 | if ( 'page' != $object->name ) |
| | 119 | return $object; |
| | 120 | |
| | 121 | $bp = buddypress(); |
| | 122 | $pages = array(); |
| | 123 | |
| | 124 | if ( ! empty( $bp->pages->activate ) ) |
| | 125 | $pages[] = $bp->pages->activate->id; |
| | 126 | |
| | 127 | if ( ! empty( $bp->pages->register ) ) |
| | 128 | $pages[] = $bp->pages->register->id; |
| | 129 | |
| | 130 | if( ! empty( $pages ) ) |
| | 131 | $object->_default_query['post__not_in'] = $pages; |
| | 132 | |
| | 133 | return $object; |
| | 134 | } |
| | 135 | add_filter( 'nav_menu_meta_box_object', 'bp_core_exclude_pages_from_nav_menu_admin', 11, 1 ); |
| | 136 | |
| | 137 | /** |