Merge pull request #17015 from woocommerce/fix/17014
Check `$item->url` is set.
This commit is contained in:
commit
590838eb82
|
@ -111,7 +111,7 @@ function wc_get_endpoint_url( $endpoint, $value = '', $permalink = '' ) {
|
|||
/**
|
||||
* Hide menu items conditionally.
|
||||
*
|
||||
* @param array $items
|
||||
* @param array $items Navigation items.
|
||||
* @return array
|
||||
*/
|
||||
function wc_nav_menu_items( $items ) {
|
||||
|
@ -120,8 +120,12 @@ function wc_nav_menu_items( $items ) {
|
|||
|
||||
if ( ! empty( $customer_logout ) ) {
|
||||
foreach ( $items as $key => $item ) {
|
||||
$path = parse_url( $item->url, PHP_URL_PATH );
|
||||
if ( empty( $item->url ) ) {
|
||||
continue;
|
||||
}
|
||||
$path = parse_url( $item->url, PHP_URL_PATH );
|
||||
$query = parse_url( $item->url, PHP_URL_QUERY );
|
||||
|
||||
if ( strstr( $path, $customer_logout ) || strstr( $query, $customer_logout ) ) {
|
||||
unset( $items[ $key ] );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue