wp core update 6.6
This commit is contained in:
@@ -491,49 +491,58 @@ function wp_registration_url() {
|
||||
* The login form HTML is echoed by default. Pass a false value for `$echo` to return it instead.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @since 6.6.0 Added `required_username` and `required_password` arguments.
|
||||
*
|
||||
* @param array $args {
|
||||
* Optional. Array of options to control the form output. Default empty array.
|
||||
*
|
||||
* @type bool $echo Whether to display the login form or return the form HTML code.
|
||||
* Default true (echo).
|
||||
* @type string $redirect URL to redirect to. Must be absolute, as in "https://example.com/mypage/".
|
||||
* Default is to redirect back to the request URI.
|
||||
* @type string $form_id ID attribute value for the form. Default 'loginform'.
|
||||
* @type string $label_username Label for the username or email address field. Default 'Username or Email Address'.
|
||||
* @type string $label_password Label for the password field. Default 'Password'.
|
||||
* @type string $label_remember Label for the remember field. Default 'Remember Me'.
|
||||
* @type string $label_log_in Label for the submit button. Default 'Log In'.
|
||||
* @type string $id_username ID attribute value for the username field. Default 'user_login'.
|
||||
* @type string $id_password ID attribute value for the password field. Default 'user_pass'.
|
||||
* @type string $id_remember ID attribute value for the remember field. Default 'rememberme'.
|
||||
* @type string $id_submit ID attribute value for the submit button. Default 'wp-submit'.
|
||||
* @type bool $remember Whether to display the "rememberme" checkbox in the form.
|
||||
* @type string $value_username Default value for the username field. Default empty.
|
||||
* @type bool $value_remember Whether the "Remember Me" checkbox should be checked by default.
|
||||
* Default false (unchecked).
|
||||
* @type bool $echo Whether to display the login form or return the form HTML code.
|
||||
* Default true (echo).
|
||||
* @type string $redirect URL to redirect to. Must be absolute, as in "https://example.com/mypage/".
|
||||
* Default is to redirect back to the request URI.
|
||||
* @type string $form_id ID attribute value for the form. Default 'loginform'.
|
||||
* @type string $label_username Label for the username or email address field. Default 'Username or Email Address'.
|
||||
* @type string $label_password Label for the password field. Default 'Password'.
|
||||
* @type string $label_remember Label for the remember field. Default 'Remember Me'.
|
||||
* @type string $label_log_in Label for the submit button. Default 'Log In'.
|
||||
* @type string $id_username ID attribute value for the username field. Default 'user_login'.
|
||||
* @type string $id_password ID attribute value for the password field. Default 'user_pass'.
|
||||
* @type string $id_remember ID attribute value for the remember field. Default 'rememberme'.
|
||||
* @type string $id_submit ID attribute value for the submit button. Default 'wp-submit'.
|
||||
* @type bool $remember Whether to display the "rememberme" checkbox in the form.
|
||||
* @type string $value_username Default value for the username field. Default empty.
|
||||
* @type bool $value_remember Whether the "Remember Me" checkbox should be checked by default.
|
||||
* Default false (unchecked).
|
||||
* @type bool $required_username Whether the username field has the 'required' attribute.
|
||||
* Default false.
|
||||
* @type bool $required_password Whether the password field has the 'required' attribute.
|
||||
* Default false.
|
||||
*
|
||||
* }
|
||||
* @return void|string Void if 'echo' argument is true, login form HTML if 'echo' is false.
|
||||
*/
|
||||
function wp_login_form( $args = array() ) {
|
||||
$defaults = array(
|
||||
'echo' => true,
|
||||
'echo' => true,
|
||||
// Default 'redirect' value takes the user back to the request URI.
|
||||
'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
|
||||
'form_id' => 'loginform',
|
||||
'label_username' => __( 'Username or Email Address' ),
|
||||
'label_password' => __( 'Password' ),
|
||||
'label_remember' => __( 'Remember Me' ),
|
||||
'label_log_in' => __( 'Log In' ),
|
||||
'id_username' => 'user_login',
|
||||
'id_password' => 'user_pass',
|
||||
'id_remember' => 'rememberme',
|
||||
'id_submit' => 'wp-submit',
|
||||
'remember' => true,
|
||||
'value_username' => '',
|
||||
'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
|
||||
'form_id' => 'loginform',
|
||||
'label_username' => __( 'Username or Email Address' ),
|
||||
'label_password' => __( 'Password' ),
|
||||
'label_remember' => __( 'Remember Me' ),
|
||||
'label_log_in' => __( 'Log In' ),
|
||||
'id_username' => 'user_login',
|
||||
'id_password' => 'user_pass',
|
||||
'id_remember' => 'rememberme',
|
||||
'id_submit' => 'wp-submit',
|
||||
'remember' => true,
|
||||
'value_username' => '',
|
||||
// Set 'value_remember' to true to default the "Remember me" checkbox to checked.
|
||||
'value_remember' => false,
|
||||
'value_remember' => false,
|
||||
// Set 'required_username' to true to add the required attribute to username field.
|
||||
'required_username' => false,
|
||||
// Set 'required_password' to true to add the required attribute to password field.
|
||||
'required_password' => false,
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -594,19 +603,21 @@ function wp_login_form( $args = array() ) {
|
||||
sprintf(
|
||||
'<p class="login-username">
|
||||
<label for="%1$s">%2$s</label>
|
||||
<input type="text" name="log" id="%1$s" autocomplete="username" class="input" value="%3$s" size="20" />
|
||||
<input type="text" name="log" id="%1$s" autocomplete="username" class="input" value="%3$s" size="20"%4$s />
|
||||
</p>',
|
||||
esc_attr( $args['id_username'] ),
|
||||
esc_html( $args['label_username'] ),
|
||||
esc_attr( $args['value_username'] )
|
||||
esc_attr( $args['value_username'] ),
|
||||
( $args['required_username'] ? ' required="required"' : '' )
|
||||
) .
|
||||
sprintf(
|
||||
'<p class="login-password">
|
||||
<label for="%1$s">%2$s</label>
|
||||
<input type="password" name="pwd" id="%1$s" autocomplete="current-password" spellcheck="false" class="input" value="" size="20" />
|
||||
<input type="password" name="pwd" id="%1$s" autocomplete="current-password" spellcheck="false" class="input" value="" size="20"%3$s />
|
||||
</p>',
|
||||
esc_attr( $args['id_password'] ),
|
||||
esc_html( $args['label_password'] )
|
||||
esc_html( $args['label_password'] ),
|
||||
( $args['required_password'] ? ' required="required"' : '' )
|
||||
) .
|
||||
$login_form_middle .
|
||||
( $args['remember'] ?
|
||||
@@ -1024,12 +1035,13 @@ function has_custom_logo( $blog_id = 0 ) {
|
||||
}
|
||||
|
||||
$custom_logo_id = get_theme_mod( 'custom_logo' );
|
||||
$is_image = ( $custom_logo_id ) ? wp_attachment_is_image( $custom_logo_id ) : false;
|
||||
|
||||
if ( $switched_blog ) {
|
||||
restore_current_blog();
|
||||
}
|
||||
|
||||
return (bool) $custom_logo_id;
|
||||
return $is_image;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1052,10 +1064,9 @@ function get_custom_logo( $blog_id = 0 ) {
|
||||
$switched_blog = true;
|
||||
}
|
||||
|
||||
$custom_logo_id = get_theme_mod( 'custom_logo' );
|
||||
|
||||
// We have a logo. Logo is go.
|
||||
if ( $custom_logo_id ) {
|
||||
if ( has_custom_logo() ) {
|
||||
$custom_logo_id = get_theme_mod( 'custom_logo' );
|
||||
$custom_logo_attr = array(
|
||||
'class' => 'custom-logo',
|
||||
'loading' => false,
|
||||
@@ -1097,21 +1108,25 @@ function get_custom_logo( $blog_id = 0 ) {
|
||||
*/
|
||||
$image = wp_get_attachment_image( $custom_logo_id, 'full', false, $custom_logo_attr );
|
||||
|
||||
if ( $unlink_homepage_logo && is_front_page() && ! is_paged() ) {
|
||||
// If on the home page, don't link the logo to home.
|
||||
$html = sprintf(
|
||||
'<span class="custom-logo-link">%1$s</span>',
|
||||
$image
|
||||
);
|
||||
} else {
|
||||
$aria_current = is_front_page() && ! is_paged() ? ' aria-current="page"' : '';
|
||||
// Check that we have a proper HTML img element.
|
||||
if ( $image ) {
|
||||
|
||||
$html = sprintf(
|
||||
'<a href="%1$s" class="custom-logo-link" rel="home"%2$s>%3$s</a>',
|
||||
esc_url( home_url( '/' ) ),
|
||||
$aria_current,
|
||||
$image
|
||||
);
|
||||
if ( $unlink_homepage_logo && is_front_page() && ! is_paged() ) {
|
||||
// If on the home page, don't link the logo to home.
|
||||
$html = sprintf(
|
||||
'<span class="custom-logo-link">%1$s</span>',
|
||||
$image
|
||||
);
|
||||
} else {
|
||||
$aria_current = is_front_page() && ! is_paged() ? ' aria-current="page"' : '';
|
||||
|
||||
$html = sprintf(
|
||||
'<a href="%1$s" class="custom-logo-link" rel="home"%2$s>%3$s</a>',
|
||||
esc_url( home_url( '/' ) ),
|
||||
$aria_current,
|
||||
$image
|
||||
);
|
||||
}
|
||||
}
|
||||
} elseif ( is_customize_preview() ) {
|
||||
// If no logo is set but we're in the Customizer, leave a placeholder (needed for the live preview).
|
||||
@@ -3579,6 +3594,7 @@ function wp_preload_resources() {
|
||||
* Filters domains and URLs for resource preloads.
|
||||
*
|
||||
* @since 6.1.0
|
||||
* @since 6.6.0 Added the `$fetchpriority` attribute.
|
||||
*
|
||||
* @param array $preload_resources {
|
||||
* Array of resources and their attributes, or URLs to print for resource preloads.
|
||||
@@ -3586,14 +3602,15 @@ function wp_preload_resources() {
|
||||
* @type array ...$0 {
|
||||
* Array of resource attributes.
|
||||
*
|
||||
* @type string $href URL to include in resource preloads. Required.
|
||||
* @type string $as How the browser should treat the resource
|
||||
* (`script`, `style`, `image`, `document`, etc).
|
||||
* @type string $crossorigin Indicates the CORS policy of the specified resource.
|
||||
* @type string $type Type of the resource (`text/html`, `text/css`, etc).
|
||||
* @type string $media Accepts media types or media queries. Allows responsive preloading.
|
||||
* @type string $imagesizes Responsive source size to the source Set.
|
||||
* @type string $imagesrcset Responsive image sources to the source set.
|
||||
* @type string $href URL to include in resource preloads. Required.
|
||||
* @type string $as How the browser should treat the resource
|
||||
* (`script`, `style`, `image`, `document`, etc).
|
||||
* @type string $crossorigin Indicates the CORS policy of the specified resource.
|
||||
* @type string $type Type of the resource (`text/html`, `text/css`, etc).
|
||||
* @type string $media Accepts media types or media queries. Allows responsive preloading.
|
||||
* @type string $imagesizes Responsive source size to the source Set.
|
||||
* @type string $imagesrcset Responsive image sources to the source set.
|
||||
* @type string $fetchpriority Fetchpriority value for the resource.
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
@@ -3641,7 +3658,7 @@ function wp_preload_resources() {
|
||||
}
|
||||
|
||||
// Ignore non-supported attributes.
|
||||
$non_supported_attributes = array( 'as', 'crossorigin', 'href', 'imagesrcset', 'imagesizes', 'type', 'media' );
|
||||
$non_supported_attributes = array( 'as', 'crossorigin', 'href', 'imagesrcset', 'imagesizes', 'type', 'media', 'fetchpriority' );
|
||||
if ( ! in_array( $resource_key, $non_supported_attributes, true ) && ! is_numeric( $resource_key ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user