Knowledgebase Docs » UberMenu 3
UberMenu 3

The ubermenu_dynamic_terms_args filter allows you to filter the terms query arguments array just before it is passed to get_terms for Dynamic Terms.

Here’s an example of using the filter. We’ll target a Dynamic Term item with the ID 473. This demonstrates how you’d alter the query arguments to use the ‘include’ parameter to whitelist a set of terms.

function um_filter_dynamic_terms_args( $term_args , $menu_item_id ){

	//Target menu item 473
	if( $menu_item_id == 473 ){

		//Whitelist the specific term IDs
		$term_args['include'] = array( 5, 21, 26, 52 );

	return $term_args;

add_filter( 'ubermenu_dynamic_terms_args' , 'um_filter_dynamic_terms_args' , 10 , 2 );


Your registered callback will be called once for each dynamic terms item. The array you return will be passed as query arguments to the get_terms() function. You have access to the query arguments (with parameters set in the menu item settings already present) and the ID of the Dynamic Terms item.

This is an array of query arguments to be passed to get_terms(). The filter callback should return this. For a full list of parameters that can be passed, please see The WordPress Codex: get_terms()
This is the ID of the Dynamic Terms menu item.