diff --git src/bp-core/admin/bp-core-admin-functions.php src/bp-core/admin/bp-core-admin-functions.php
index 609453741..f6c73dbb6 100644
|
|
function bp_core_admin_body_classes( $classes ) { |
1135 | 1135 | return $classes . ' buddypress'; |
1136 | 1136 | } |
1137 | 1137 | add_filter( 'admin_body_class', 'bp_core_admin_body_classes' ); |
| 1138 | |
| 1139 | /** |
| 1140 | * Adds a BuddyPress category to house BuddyPress blocks. |
| 1141 | * |
| 1142 | * @since 5.0.0 |
| 1143 | * |
| 1144 | * @param array $default_categories Array of block categories. |
| 1145 | * @param WP_Post $post Post being loaded. |
| 1146 | */ |
| 1147 | function bp_block_category( $categories = array(), WP_Post $post ) { |
| 1148 | /** |
| 1149 | * Filter here to add/remove the supported post types for the BuddyPress blocks category. |
| 1150 | * |
| 1151 | * @since 5.0.0 |
| 1152 | * |
| 1153 | * @param array $value The list of supported post types. Defaults to WordPress built-in ones. |
| 1154 | */ |
| 1155 | $post_types = apply_filters( 'bp_block_category_post_types', array( 'post', 'page' ) ); |
| 1156 | |
| 1157 | if ( ! $post_types ) { |
| 1158 | return $categories; |
| 1159 | } |
| 1160 | |
| 1161 | // Get the post type of the current item. |
| 1162 | $post_type = get_post_type( $post ); |
| 1163 | |
| 1164 | if ( ! in_array( $post_type, $post_types, true ) ) { |
| 1165 | return $categories; |
| 1166 | } |
| 1167 | |
| 1168 | return array_merge( $categories, array( |
| 1169 | array( |
| 1170 | 'slug' => 'buddypress', |
| 1171 | 'title' => __( 'BuddyPress', 'buddypress' ), |
| 1172 | 'icon' => 'buddicons-buddypress-logo', |
| 1173 | ), |
| 1174 | ) ); |
| 1175 | } |
| 1176 | add_filter( 'block_categories', 'bp_block_category', 1, 2 ); |