Back when I first started my personal blog, I was using a theme with a custom home page and no blog page template. This posed a problem as I didn’t have a good archive for all of my posts, so I setup a default category “All” that every post was added to. This worked pretty good for that theme, but presented problems for me in Genesis.
Specifically, the breadcrumb showed this “all” category instead of the primary category for my posts. I wrote this simple work around to hide the this category from my breadcrumb
add_action( 'genesis_before_loop', 'child_skip_terms', 5 ); /** Starts Skipping Terms Before BreadCrumb */ function child_skip_terms() { add_filter( 'get_the_terms', 'child_do_skip_terms' ); } add_action( 'genesis_loop', 'child_stop_skip_terms', 5 ); /** Stop Skipping Terms After BreadCrumb */ function child_stop_skip_terms() { remove_filter( 'get_the_terms', 'child_do_skip_terms' ); } /** * Skips Terms from get_the_terms based on termID. * * @author Nick_theGeek * @url https://designsbynickthegeek.com/tutorials/skip-terms * @param array $terms * @return array */ function child_do_skip_terms( $terms ) { $skipterms = array( 3 ); //supply comma separated value of term IDs like array( 3, 56, 79 ), this will work for any term regardless of taxonomy. foreach ( $skipterms as $skip ) { unset( $terms[$skip] ); } return $terms; }
This particular usage lets my “all” category show in the Post Meta, just not the Breadcrumb. That suits my needs, but a very simple change will hide the term from the Post Meta as well. Change this line
add_action( 'genesis_loop', 'child_stop_skip_terms', 5 );
to
add_action( 'genesis_after_loop', 'child_stop_skip_terms' );