Changeset 7741
- Timestamp:
- 01/20/2014 08:47:39 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-filters.php
r7612 r7741 98 98 } 99 99 add_filter( 'wp_list_pages_excludes', 'bp_core_exclude_pages' ); 100 101 /** 102 * Prevent specific pages (eg 'Activate') from showing in the Pages meta box of the Menu Administration 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 ); 100 136 101 137 /**
Note: See TracChangeset
for help on using the changeset viewer.