Skip to:
Content

BuddyPress.org

Changeset 12956


Ignore:
Timestamp:
05/22/2021 02:09:15 PM (4 years ago)
Author:
imath
Message:

BP Blocks: make sure the BuddyPress category is available in WP >= 5.8

As blocks are always loaded even if the category is not available, there's no more interest in disabling the BuddyPress category. As a result we deprecated the bp_block_category_post_types filter.

Fixes #8465

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/admin/bp-core-admin-functions.php

    r12944 r12956  
    13051305 *
    13061306 * @since 5.0.0
    1307  *
    1308  * @param array  $categories Array of block categories.
    1309  * @param object $post       Post being loaded.
    1310  */
    1311 function bp_block_category( $categories = array(), $post = null ) {
    1312     if ( ! ( $post instanceof WP_Post ) ) {
    1313         return $categories;
    1314     }
    1315 
    1316     /**
    1317      * Filter here to add/remove the supported post types for the BuddyPress blocks category.
    1318      *
    1319      * @since 5.0.0
    1320      *
    1321      * @param array $value The list of supported post types. Defaults to WordPress built-in ones.
    1322      */
    1323     $post_types = apply_filters( 'bp_block_category_post_types', array( 'post', 'page' ) );
    1324 
    1325     if ( ! $post_types ) {
    1326         return $categories;
    1327     }
    1328 
    1329     // Get the post type of the current item.
    1330     $post_type = get_post_type( $post );
    1331 
    1332     if ( ! in_array( $post_type, $post_types, true ) ) {
    1333         return $categories;
     1307 * @since 8.0.0 The `bp_block_category_post_types` filter has been deprecated.
     1308 *
     1309 * @param array          $categories Array of block categories.
     1310 * @param string|WP_Post $post       Post being loaded.
     1311 */
     1312function bp_block_category( $categories = array(), $editor_name_or_post = null ) {
     1313    if ( $editor_name_or_post instanceof WP_Post ) {
     1314        $post_types = array( 'post', 'page' );
     1315
     1316        /*
     1317         * As blocks are always loaded even if the category is not available, there's no more interest
     1318         * in disabling the BuddyPress category.
     1319         */
     1320        apply_filters_deprecated( 'bp_block_category_post_types', array( $post_types ), '8.0.0' );
    13341321    }
    13351322
Note: See TracChangeset for help on using the changeset viewer.