Ticket #49553: 49553.diff
File 49553.diff, 2.3 KB (added by , 5 years ago) |
---|
-
src/wp-includes/general-template.php
192 192 * Optional. Array of display arguments. 193 193 * 194 194 * @type bool $echo Whether to echo or return the form. Default true. 195 * @type bool $show_query Whether to show the search query. Default true. 195 196 * @type string $aria_label ARIA label for the search form. Useful to distinguish 196 197 * multiple search forms on the same page and improve 197 198 * accessibility. Default empty. … … 223 224 $args = array(); 224 225 } 225 226 226 // Defaults are to echo and to output no custom label on the form.227 // Defaults are to echo, show current search query and to output no custom label on the form. 227 228 $defaults = array( 228 229 'echo' => $echo, 230 'show_query' => true, 229 231 'aria_label' => '', 230 232 ); 231 233 … … 272 274 $form = '<form role="search" ' . $aria_label . 'method="get" class="search-form" action="' . esc_url( home_url( '/' ) ) . '"> 273 275 <label> 274 276 <span class="screen-reader-text">' . _x( 'Search for:', 'label' ) . '</span> 275 <input type="search" class="search-field" placeholder="' . esc_attr_x( 'Search …', 'placeholder' ) . '" value="' . get_search_query() . '" name="s" />277 <input type="search" class="search-field" placeholder="' . esc_attr_x( 'Search …', 'placeholder' ) . '" value="' . ( $args['show_query'] ? get_search_query() : '' ) . '" name="s" /> 276 278 </label> 277 279 <input type="submit" class="search-submit" value="' . esc_attr_x( 'Search', 'submit button' ) . '" /> 278 280 </form>'; … … 280 282 $form = '<form role="search" ' . $aria_label . 'method="get" id="searchform" class="searchform" action="' . esc_url( home_url( '/' ) ) . '"> 281 283 <div> 282 284 <label class="screen-reader-text" for="s">' . _x( 'Search for:', 'label' ) . '</label> 283 <input type="text" value="' . get_search_query() . '" name="s" id="s" />285 <input type="text" value="' . ( $args['show_query'] ? get_search_query() : '' ) . '" name="s" id="s" /> 284 286 <input type="submit" id="searchsubmit" value="' . esc_attr_x( 'Search', 'submit button' ) . '" /> 285 287 </div> 286 288 </form>';