This snippet will automatically fill in the meta description in categories that do not have a description in the site admin panel.
function add_meta_description_to_listing_category() {
if ( is_tax( 'hp_listing_category' ) ) {
$term = get_queried_object();
if ( empty( $term->description ) ) {
$category_name = $term->name;
$meta_description = ' ' . $category_name . ' | Your text for meta description';
echo '<meta name="description" content="' . esc_attr( $meta_description ) . '" />';
}
}
}
add_action( 'wp_head', 'add_meta_description_to_listing_category' );