Genesis: Remove/Change post info/post meta
// Remove post meta
remove_action('genesis_after_post_content', 'genesis_post_meta');
// Customize the post meta function
add_filter('genesis_post_meta', 'post_meta_filter');
function post_meta_filter($post_meta) {
if (!is_page()) {
// Spaces are added to [ shortcodes ] for display. Do not include.
$post_meta = 'Filed Under: [ post_categories ], Tagged: [ post_tags ]';
return $post_meta;
}}
// Remove the post info function
remove_action('genesis_before_post_content', 'genesis_post_info');
// Customize the post info function
add_filter('genesis_post_info', 'post_info_filter');
function post_info_filter($post_info) {
if (!is_page()) {
// Spaces are added to [ shortcodes ] for display. Do not include.
$post_info = '[ post_date ] by [ post_author_posts_link ] at [ post_time ] [ post_comments ] [ post_edit ]';
return $post_info;
}}
Please note that you do not need to remove the functions before editing them. Hat tip to jim




Jan 13, 2012 @ 09:33:54
You should make a note that it’s not necessary to remove a function, then edit it.
Most people are going to want to remove OR edit, but probably not both. It’s a little unclear that you don’t have to remove to edit.
←
Jan 13, 2012 @ 10:31:11
Good point. Thanks Jim. I was trying to show how to remove or edit as separate actions but I can see where it could be confusing . I will make a note.
←
May 09, 2012 @ 14:29:51
How would one modify this so that you could remove post meta for just custom post types?
←
May 09, 2012 @ 15:30:54
You could do something like this:
add_action('genesis_before', 'remove_cpt_meta');
function remove_cpt_meta() {
$post_type = get_query_var('post_type');
if( !empty( $post_type ) && ( $post_type != 'post' ) ) {
remove_action('genesis_after_post_content', 'genesis_post_meta');
}
}
←
May 10, 2012 @ 13:33:18
Hey Lori,
Thanks for the reply. That snippet didn’t work for me, but this did.
add_action(‘genesis_before’, ‘remove_cpt_meta’);
function remove_cpt_meta() {
if( is_single && ! is_single(‘post’) ) {
remove_action(‘genesis_after_post_content’, ‘genesis_post_meta’);
}
}
I then added another bit of code to remove post info as well:
add_action(‘genesis_before’, ‘remove_cpt_info’);
function remove_cpt_info() {
if( is_single && ! is_single(‘post’) ) {
remove_action(‘genesis_before_post_content’, ‘genesis_post_info’);
}
}
Now I just need a better way to write both pieces of code so that they are more efficient. I’m not a great coder by any measure, so, yeah. =)
Thanks for the help!
←
May 10, 2012 @ 13:55:36
Hi Alex,
Glad you got it working
Didn’t notice that you were only trying to remove the meta from single posts.
For efficiency, you can do this:
if( is_single && ! is_single(‘post’) ) {
remove_action(‘genesis_before_post_content’, ‘genesis_post_info’);
remove_action(‘genesis_after_post_content’, ‘genesis_post_meta’);
}
I haven’t tested it, but I don’t see any reason why it would not work.
←
May 10, 2012 @ 19:59:11
WordUp! Thanks for the Tip, Lori. =)
←