mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-31 21:48:36 +01:00
Customize: Include nav menu item for Home custom link in search results for "Home".
Props audrasjb, westonruter. Merges [42611] to the 4.9 branch. Fixes #42991. Built from https://develop.svn.wordpress.org/branches/4.9@42621 git-svn-id: http://core.svn.wordpress.org/branches/4.9@42450 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a271c43cdb
commit
a07ed5c926
@ -370,6 +370,22 @@ final class WP_Customize_Nav_Menus {
|
||||
}
|
||||
}
|
||||
|
||||
// Add "Home" link if search term matches. Treat as a page, but switch to custom on add.
|
||||
if ( isset( $args['s'] ) ) {
|
||||
$title = _x( 'Home', 'nav menu home label' );
|
||||
$matches = function_exists( 'mb_stripos' ) ? false !== mb_stripos( $title, $args['s'] ) : false !== stripos( $title, $args['s'] );
|
||||
if ( $matches ) {
|
||||
$items[] = array(
|
||||
'id' => 'home',
|
||||
'title' => $title,
|
||||
'type' => 'custom',
|
||||
'type_label' => __( 'Custom Link' ),
|
||||
'object' => '',
|
||||
'url' => home_url(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the available menu items during a search request.
|
||||
*
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.9.3-beta1-42620';
|
||||
$wp_version = '4.9.3-beta1-42621';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user