Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
add_filter( 'wpsl_store_meta', 'custom_store_meta', 10, 2 );
function custom_store_meta( $store_meta, $store_id ) {
$terms = wp_get_post_terms( $store_id, 'wpsl_store_category' );
$store_meta['terms'] = '';
if ( $terms ) {
if ( !is_wp_error( $terms ) ) {
if ( count( $terms ) > 1 ) {
$location_terms = array();
foreach ( $terms as $term ) {
$location_terms[] = $term->name;
}
$store_meta['terms'] = implode( ', ', $location_terms );
} else {
$store_meta['terms'] = $terms[0]->name;
}
}
}
return $store_meta;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment