Skip to content

Actions and filters

Menu icons: 3 hooks.

Every hook here has a description in the source.

2 actions1 filter

filter

davo_menu_icons_item_settings_fields

Extra settings fields shown in the media frame's sidebar, and as hidden inputs on each menu item's own row, when this icon type is selected. Empty by default — a genuine extension point, unlike this mechanism's previous incarnation, which always returned nothing regardless of what a type or another domain tried to contribute.

Parameters of davo_menu_icons_item_settings_fields
ParameterTypeDescription
$fieldsarray<int, array<string, mixed>>Field configs, each with at least id/label/value/type.
$type_idstringThis type's ID.
add_filter
add_filter( 'davo_menu_icons_item_settings_fields', 'my_filter_callback', 10, 2 );

/**
 * @param array<int, array<string, mixed>> $fields
 * @param string $type_id
 */
function my_filter_callback( $fields, $type_id ) {
	// Change $fields as needed, then return it.
	return $fields;
}

src/domains/menu-icons/types/base.php:86

action

davo_menu_item_icon_updated

Fires after a navigation menu item's icon meta is updated or cleared.

Parameters of davo_menu_item_icon_updated
ParameterTypeDescription
$menu_item_idintNav menu item post ID.
add_action
add_action( 'davo_menu_item_icon_updated', 'my_action_callback', 10, 1 );

/**
 * @param int $menu_item_id
 */
function my_action_callback( $menu_item_id ) {
	// Your code here.
}

src/domains/menu-icons/repository.php:253

action

davo_register_menu_icon_types

Register menu icon types.

Parameters of davo_register_menu_icon_types
ParameterTypeDescription
$registryMenu_Icons_Type_RegistryShared registry instance. Call $registry->register( $type ) to add one.
add_action
add_action( 'davo_register_menu_icon_types', 'my_action_callback', 10, 1 );

/**
 * @param Menu_Icons_Type_Registry $registry
 */
function my_action_callback( $registry ) {
	// Your code here.
}

src/domains/menu-icons/initializer.php:245

Note. Generated from the plugin source. Descriptions and parameters are the ones written in the code. The starter code uses the parameter names from those comments, or generic names where there are none, so check them against your use.

See it on your own site.

Davo is a WordPress theme and plugin by Exorex.

  • Runs on your own WordPress
  • Guided setup wizard
  • AI is off until you switch it on
  • Read the licence on the marketplace first