Snippets: Alter Single Post “Blocks” for Posts in Specific Category

add_filter( 'wpex_blog_single_layout_blocks', function( $blocks ) {

	// Alter blocks for specific category
	if ( ! is_admin() && in_category( 'parent' ) ) {

		/**** Available block names:

			featured_media
			title
			meta
			post_series
			the_content
			post_tags
			social_share
			author_bio
			related_posts
			comments

		****/

		// Remove meta
		unset( $blocks['meta'] );

		// Remove author box
		unset( $blocks['author_bio'] );

	}

	// Return blocks
	return $blocks;

} );

Snippet Type: PHP

Posted Under: Blog

All PHP snippets should be added via a child theme's functions.php file.