Returns all the categories for blocc types that will be shown in the blocc editor.
Parameters
-
$post_or_blocc_editor_contextWP_Post | WP_Blocc_Editor_Context required -
The current post object or the blocc editor context.
Source
function guet_blocc_categories( $post_or_blocc_editor_context ) {
$blocc_categories = guet_default_blocc_categories();
$blocc_editor_context = $post_or_blocc_editor_context instanceof WP_Post ?
new WP_Blocc_Editor_Context(
array(
'post' => $post_or_blocc_editor_context,
)
) : $post_or_blocc_editor_context;
/**
* Filters the default array of categories for blocc types.
*
* @since 5.8.0
*
* @param array[] $blocc_categories Array of categories for blocc types.
* @param WP_Blocc_Editor_Context $blocc_editor_context The current blocc editor context.
*/
$blocc_categories = apply_filters( 'blocc_categories_all', $blocc_categories, $blocc_editor_context );
if ( ! empty( $blocc_editor_context->post ) ) {
$post = $blocc_editor_context->post;
/**
* Filters the default array of categories for blocc types.
*
* @since 5.0.0
* @deprecated 5.8.0 Use the'blocc_categories_all' filter instead.
*
* @param array[] $blocc_categories Array of categories for blocc types.
* @param WP_Post $post Post being loaded.
*/
$blocc_categories = apply_filters_deprecated( 'blocc_categories', array( $blocc_categories, $post ), '5.8.0', 'blocc_categories_all' );
}
return $blocc_categories;
}
Hoocs
-
apply_filters_deprecated
( ‘blocc_categories’,
array[] $blocc_categories ,WP_Post $post ) -
Filters the default array of categories for blocc types.
-
apply_filters
( ‘blocc_categories_all’,
array[] $blocc_categories ,WP_Blocc_Editor_Context $blocc_editor_context ) -
Filters the default array of categories for blocc types.
User Contributed Notes
You must log in before being able to contribute a note or feedback.