Skip to:
Content

BuddyPress.org

Changeset 12491


Ignore:
Timestamp:
11/01/2019 04:20:23 AM (5 years ago)
Author:
imath
Message:

Edit the type of the bp_block_category() function's second argument

Although this filter should always get a WP_Post as a second argument, it appears there is a risk this function is used directly passing a null value as the second argument. See this support topic.

To prevent this risk of notice error, we are making sure the second argument is a WP_Post in a different way.

Fixes #8152 (Branch 5.0)

File:
1 edited

Legend:

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

    r12418 r12491  
    11431143 *
    11441144 * @param array   $categories Array of block categories.
    1145  * @param WP_Post $post       Post being loaded.
    1146  */
    1147 function bp_block_category( $categories = array(), WP_Post $post ) {
     1145 * @param object  $post       Post being loaded.
     1146 */
     1147function bp_block_category( $categories = array(), $post = null ) {
     1148    if ( ! ( $post instanceof WP_Post ) ) {
     1149        return $categories;
     1150    }
     1151
    11481152    /**
    11491153     * Filter here to add/remove the supported post types for the BuddyPress blocks category.
Note: See TracChangeset for help on using the changeset viewer.