Changeset 12728 for trunk/src/bp-core/bp-core-taxonomy.php
- Timestamp:
- 09/21/2020 01:09:16 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-taxonomy.php
r12727 r12728 16 16 17 17 /** 18 * Returns default BuddyPress taxonomies. 19 * 20 * @since 7.0.0 21 * 22 * @return array The BuddyPress default taxonomies. 23 */ 24 function bp_get_default_taxonomies() { 25 $taxonomies = array( 26 // Member Type. 27 bp_get_member_type_tax_name() => array( 28 'object' => 'user', 29 'component' => 'members', 30 'args' => bp_get_member_type_tax_args(), 31 ), 32 // Email type. 33 bp_get_email_tax_type() => array( 34 'object' => bp_get_email_post_type(), 35 'component' => 'core', 36 'args' => bp_get_email_tax_type_args(), 37 ), 38 ); 39 40 /** 41 * This filter should only be used by built-in BuddyPress Components. 42 * 43 * @since 7.0.0 44 * 45 * @param array $taxonomies The taxonomy arguments used for WordPress registration. 46 */ 47 return apply_filters( 'bp_get_default_taxonomies', $taxonomies ); 48 } 49 50 /** 18 51 * Register our default taxonomies. 19 52 * … … 21 54 */ 22 55 function bp_register_default_taxonomies() { 23 // Member Type. 24 register_taxonomy( bp_get_member_type_tax_name(), 'user', array( 25 'public' => false, 26 ) ); 27 28 // Email type. 29 register_taxonomy( 30 bp_get_email_tax_type(), 31 bp_get_email_post_type(), 32 apply_filters( 'bp_register_email_tax_type', array( 33 'description' => _x( 'BuddyPress email types', 'email type taxonomy description', 'buddypress' ), 34 'labels' => bp_get_email_tax_type_labels(), 35 'meta_box_cb' => 'bp_email_tax_type_metabox', 36 'public' => false, 37 'query_var' => false, 38 'rewrite' => false, 39 'show_in_menu' => false, 40 'show_tagcloud' => false, 41 'show_ui' => bp_is_root_blog() && bp_current_user_can( 'bp_moderate' ), 42 ) ) 43 ); 56 $taxonomies = bp_get_default_taxonomies(); 57 58 foreach ( $taxonomies as $taxonomy_name => $taxonomy_params ) { 59 if ( ! isset( $taxonomy_params['object'] ) || ! isset( $taxonomy_params['args'] ) ) { 60 continue; 61 } 62 63 register_taxonomy( 64 $taxonomy_name, 65 $taxonomy_params['object'], 66 $taxonomy_params['args'] 67 ); 68 } 44 69 } 45 70 add_action( 'bp_register_taxonomies', 'bp_register_default_taxonomies' );
Note: See TracChangeset
for help on using the changeset viewer.