generate_category_list_output

generate_category_list_output

The generate_category_list_output filter controls the output of your categories as shown in your post meta along with your blog posts.

For example, we can use this PHP snippet to remove the link attached to the category output:

add_filter( 'generate_category_list_output', function() {
$categories = apply_filters( 'generate_show_categories', true );

$term_separator = apply_filters( 'generate_term_separator', _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ), 'categories' );
$categories_list = get_the_category_list( $term_separator );

return sprintf( '%3$s%1$s %2$s ', // WPCS: XSS ok, sanitization ok.
esc_html_x( 'Categories', 'Used before category names.', 'generatepress' ),
strip_tags( $categories_list ),
apply_filters( 'generate_inside_post_meta_item_output', '', 'categories' )
);
} );

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注