WordPress.org

Make WordPress Core

Ticket #8874: 8874.wp_page_menu.patch

File 8874.wp_page_menu.patch, 1.1 KB (added by hakre, 5 years ago)

Just found while taking a look into this ticket. wp_page_menu improvements.

  • wp-includes/post-template.php

     
    801801 * @param array|string $args 
    802802 */ 
    803803function wp_page_menu( $args = array() ) { 
    804         $defaults = array('sort_column' => 'post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => ''); 
     804        $defaults = array('sort_column' => 'post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => '', 'show_home' => ''); 
    805805        $args = wp_parse_args( $args, $defaults ); 
    806806        $args = apply_filters( 'wp_page_menu_args', $args ); 
    807807 
     
    810810        $list_args = $args; 
    811811 
    812812        // Show Home in the menu 
    813         if ( isset($args['show_home']) && ! empty($args['show_home']) ) { 
    814                 if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] ) 
     813        if ( ! empty($args['show_home']) ) { 
     814                if ( '1' === (string) $args['show_home'] ) 
    815815                        $text = __('Home'); 
    816816                else 
    817817                        $text = $args['show_home'];