Menus: Add a short-circuit filter to `wp_setup_nav_menu_item()`.
Props: davidbinda, ironprogrammer, andizer. Fixes: #56577. Built from https://develop.svn.wordpress.org/trunk@55867 git-svn-id: http://core.svn.wordpress.org/trunk@55379 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f4b232f74c
commit
91b653f5cd
|
@ -820,6 +820,22 @@ function update_menu_item_cache( $menu_items ) {
|
|||
* @return object The menu item with standard menu item properties.
|
||||
*/
|
||||
function wp_setup_nav_menu_item( $menu_item ) {
|
||||
|
||||
/**
|
||||
* Short-circuit the wp_setup_nav_menu_item() output.
|
||||
*
|
||||
* Returning a non-null value from the filter will short-circuit wp_setup_nav_menu_item(),
|
||||
* and return that value.
|
||||
*
|
||||
* @param object|null $modified_menu_item Modified menu item. Default null.
|
||||
* @param object $menu_item The menu item to modify.
|
||||
*/
|
||||
$pre_menu_item = apply_filters( 'pre_wp_setup_nav_menu_item', null, $menu_item );
|
||||
|
||||
if ( null !== $pre_menu_item ) {
|
||||
return $pre_menu_item;
|
||||
}
|
||||
|
||||
if ( isset( $menu_item->post_type ) ) {
|
||||
if ( 'nav_menu_item' === $menu_item->post_type ) {
|
||||
$menu_item->db_id = (int) $menu_item->ID;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.3-alpha-55866';
|
||||
$wp_version = '6.3-alpha-55867';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue