Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Get term by name

Get term name and search term by description

// WP_Term_Query arguments
$args = array(
	'taxonomy'               => array( 'category', 'post_tag', 'product_cat', 'product_tag' ),
	'name'                   => array( '$name' ),
	'search'                 => 'car',
	'name__like'             => '$s',
	'description__like'      => '$s',
	'hierarchical'           => true,
	'number'                 => 999999,
	'offset'                 => 1,
	'meta_key'               => 'like',
	'meta_value'             => '$s',
	'fields'                 => 'id=>name',
	'hide_empty'             => true,
	'get'                    => 'all',
	'cache_domain'           => 'terms_name',
	'update_term_meta_cache' => true,
);

// The Term Query
$term_query = new WP_Term_Query( $args );

// The Loop
if ( ! empty( $term_query ) && ! is_wp_error( $term_query ) ) {
	// do something
} else {
	// no terms found
}