Remove Post Info and Post Meta from Custom Post Types in Genesis Theme in WordPress

After creating custom post types in WordPress on a Genesis theme by default the post info is displayed which contains the post author, post date and comments info and the post meta is also displayed which contains the category and tag values.

custom-post-info-custom-post-type

You may want to have these values removed for your custom post types but leave them intact for regular posts. This is possible by adding an action and function in your themes functions.php file:

add_action ( 'genesis_before_loop', 'themeprefix_remove_post_info' );
// Remove Post Info, Post Meta from CPT
function themeprefix_remove_post_info() {
	if ('custom_post_type_name' == get_post_type()) {//add in your CPT name
		remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
		remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
	}
}

All you need to swap in the above code is your custom_post_type name in the if statement. Then these post info and post meta data is removed just from that custom post type.

custom-post-info-custom-post-type-no-meta

The remove action for the genesis_post_info has a priority number set (12), this is because the original action is added with this number in the post.php file in the structure directory of the Genesis framework. To remove the original action they have to be exactly the same.

Remove Post Info and Meta from all CPTs apart from Posts

I find that I typically only use post info and post meta on posts only and not any other custom post types, you could add a catch all piece of code to prevent the post info and post meta from appearing in any post type apart from posts by using the not equals operator !

	
add_action ( 'genesis_before_loop', 'themeprefix_remove_post_info' );
/**
 * Remove Post Info and Post Meta on all CPTs but leave on posts
 */
function themeprefix_remove_post_info() {
	if ( 'post' !== get_post_type() ) {//add in your CPT name
		remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
		remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
	}
}

So in the code snippet anything other then posts will not have the info and metas because of

'post' !== get_post_type()