wp_update_themes example


function _maybe_update_themes() {
    $current = get_site_transient( 'update_themes' );

    if ( isset( $current->last_checked )
        && 12 * HOUR_IN_SECONDS > ( time() - $current->last_checked )
    ) {
        return;
    }

    wp_update_themes();
}

/** * Schedules core, theme, and plugin update checks. * * @since 3.1.0 */
function wp_schedule_update_checks() {
    if ( ! wp_next_scheduled( 'wp_version_check' ) && ! wp_installing() ) {
        wp_schedule_event( time(), 'twicedaily', 'wp_version_check' );
    }

    
        wp_update_plugins(); // Check for plugin updates.         $plugin_updates = get_site_transient( 'update_plugins' );
        if ( $plugin_updates && ! empty( $plugin_updates->response ) ) {
            foreach ( $plugin_updates->response as $plugin ) {
                $this->update( 'plugin', $plugin );
            }
            // Force refresh of plugin update information.             wp_clean_plugins_cache();
        }

        // Next, those themes we all love.         wp_update_themes();  // Check for theme updates.         $theme_updates = get_site_transient( 'update_themes' );
        if ( $theme_updates && ! empty( $theme_updates->response ) ) {
            foreach ( $theme_updates->response as $theme ) {
                $this->update( 'theme', (object) $theme );
            }
            // Force refresh of theme update information.             wp_clean_themes_cache();
        }

        // Next, process any core update.         wp_version_check(); // Check for core updates.
#[AllowDynamicProperties] class WP_Debug_Data {
    /** * Calls all core functions to check for updates. * * @since 5.2.0 */
    public static function check_for_updates() {
        wp_version_check();
        wp_update_plugins();
        wp_update_themes();
    }

    /** * Static function for generating site debug data when required. * * @since 5.2.0 * @since 5.3.0 Added database charset, database collation, * and timezone information. * @since 5.5.0 Added pretty permalinks support information. * * @throws ImagickException * @global wpdb $wpdb WordPress database abstraction object. * @global array $_wp_theme_features * * @return array The debug data for the site. */


    $theme = wp_get_theme( $stylesheet );
    if ( $theme->exists() ) {
        $status['oldVersion'] = $theme->get( 'Version' );
    }

    require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';

    $current = get_site_transient( 'update_themes' );
    if ( empty( $current ) ) {
        wp_update_themes();
    }

    $skin     = new WP_Ajax_Upgrader_Skin();
    $upgrader = new Theme_Upgrader( $skin );
    $result   = $upgrader->bulk_upgrade( array( $stylesheet ) );

    if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
        $status['debug'] = $skin->get_upgrade_messages();
    }

    if ( is_wp_error( $skin->result ) ) {
        
Home | Imprint | This part of the site doesn't use cookies.