Returns the JavaScript template used to display the auto-update setting for a theme.
Source
function wp_theme_auto_update_setting_template() {
$notice = wp_get_admin_notice(
'',
array(
'type' => 'error',
'additional_classes' => array( 'notice-alt', 'inline', 'hidden' ),
)
);
$template = '
<div class="theme-autoupdate">
<# if ( data.autoupdate.supported ) { #>
<# if ( data.autoupdate.forced === false ) { #>
' . __( 'Auto-updates disabled' ) . '
<# } else if ( data.autoupdate.forced ) { #>
' . __( 'Auto-updates enabled' ) . '
<# } else if ( data.autoupdate.enabled ) { #>
<button type="button" class="toggle-auto-update button-link" data-slug="{{ data.id }}" data-wp-action="disable">
<span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span><span class="label">' . __( 'Disable auto-updates' ) . '</span>
</button>
<# } else { #>
<button type="button" class="toggle-auto-update button-link" data-slug="{{ data.id }}" data-wp-action="enable">
<span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span><span class="label">' . __( 'Enable auto-updates' ) . '</span>
</button>
<# } #>
<# } #>
<# if ( data.hasUpdate ) { #>
<# if ( data.autoupdate.supported && data.autoupdate.enabled ) { #>
<span class="auto-update-time">
<# } else { #>
<span class="auto-update-time hidden">
<# } #>
<br />' . wp_get_auto_update_message() . '</span>
<# } #>
' . $notice . '
</div>
';
/**
* Filters the JavaScript template used to display the auto-update setting for a theme (in the overlay).
*
* See wp_prepare_themes_for_js() for the properties of the `data` object.
*
* @since 5.5.0
*
* @param string $template The template for displaying the auto-update setting link.
*/
return apply_filters( 'theme_auto_update_setting_template', $template );
}
Hooks
- apply_filters( ‘theme_auto_update_setting_template’,
string $template ) Filters the JavaScript template used to display the auto-update setting for a theme (in the overlay).
Changelog
Version | Description |
---|---|
5.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.