Posted on

Change Default Search Box Taxonomies Names

Sometime we need to change default search box taxonomies names and give them a meaningful name. It's help customer to understand better.

Now we are going to change those name with the help of our plugin's filter hook.

 if( !function_exists( 'codeastrology_wpto_searchbox_taxonomy_name' ) ){

	function codeastrology_wpto_searchbox_taxonomy_name( $taxonomy_name, $taxonomy_keyword){

		if( $taxonomy_keyword == "product_cat"){
			$taxonomy_name = "Filter by Category";
		}

		if( $taxonomy_keyword == "product_tag"){
			$taxonomy_name = "Filter by Tag";
		}
		
		return $taxonomy_name;
	}
 }

 add_filter( 'wpto_searchbox_taxonomy_name', 'codeastrology_wpto_searchbox_taxonomy_name', 10,2 );

Add those code in your theme/child theme's functions.php file or use 'Code Snippets' plugin to add those code. Take a look

Still no luck? We can help!

Submit a Request

Contact us and we’ll get back to you as soon as possible.