wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



register_site_editor_menu_item › WordPress Function

Seitn/v
Veraltetn/v
register_site_editor_menu_item ( $id, $label, $to, $parent_id = '', $parent_type = '' )
Parameter: (5)
  • (string) $id Menu item ID.
    Erforderlich: Ja
  • (string) $label Display label.
    Erforderlich: Ja
  • (string) $to Route path to navigate to.
    Erforderlich: Ja
  • (string) $parent_id Optional. Parent menu item ID.
    Erforderlich: Nein
    Standard: (leer)
  • (string) $parent_type Optional. Parent type: 'drilldown' or 'dropdown'.
    Erforderlich: Nein
    Standard: (leer)
Definiert in:
Codex:

Register a menu item for the site-editor page.



Quellcode

function register_site_editor_menu_item( $id, $label, $to, $parent_id = '', $parent_type = '' ) {
		global $wp_site_editor_menu_items;

		$menu_item = array(
			'id'    => $id,
			'label' => $label,
			'to'    => $to,
		);

		if ( ! empty( $parent_id ) ) {
			$menu_item['parent'] = $parent_id;
		}

		if ( ! empty( $parent_type ) && in_array( $parent_type, array( 'drilldown', 'dropdown' ), true ) ) {
			$menu_item['parent_type'] = $parent_type;
		}

		$wp_site_editor_menu_items[] = $menu_item;
	}
}