bp_core_exclude_pages_from_nav_menu_admin( object|null $object = null )
Prevent specific pages (eg ‘Activate’) from showing in the Pages meta box of the Menu Administration screen.
Description
Parameters
- $object
-
(Optional) The post type object used in the meta box.
Default value: null
Return
(object|null) The $object, with a query argument to remove register and activate pages id.
Source
File: bp-core/bp-core-filters.php
function bp_core_exclude_pages_from_nav_menu_admin( $object = null ) {
// Bail if not the root blog.
if ( ! bp_is_root_blog() ) {
return $object;
}
if ( 'page' != $object->name ) {
return $object;
}
$bp = buddypress();
$pages = array();
if ( ! empty( $bp->pages->activate ) ) {
$pages[] = $bp->pages->activate->id;
}
if ( ! empty( $bp->pages->register ) ) {
$pages[] = $bp->pages->register->id;
}
if ( ! empty( $pages ) ) {
$object->_default_query['post__not_in'] = $pages;
}
return $object;
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 2.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.