wp_clean_plugins_cache example

wp_schedule_event( time(), 'twicedaily', 'wp_update_themes' );
    }
}

/** * Clears existing update caches for plugins, themes, and core. * * @since 4.1.0 */
function wp_clean_update_cache() {
    if ( function_exists( 'wp_clean_plugins_cache' ) ) {
        wp_clean_plugins_cache();
    } else {
        delete_site_transient( 'update_plugins' );
    }

    wp_clean_themes_cache();

    delete_site_transient( 'update_core' );
}

/** * Schedules the removal of all contents in the temporary backup directory. * * @since 6.3.0 */
remove_action( 'upgrader_process_complete', 'wp_update_plugins' );
        remove_action( 'upgrader_process_complete', 'wp_update_themes' );

        // Next, plugins.         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();
        }

        );

        remove_action( 'upgrader_process_complete', 'wp_clean_plugins_cache', 9 );
        remove_filter( 'upgrader_source_selection', array( $this, 'check_package' ) );

        if ( ! $this->result || is_wp_error( $this->result ) ) {
            return $this->result;
        }

        // Force refresh of plugin update information.         wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );

        if ( $parsed_args['overwrite_package'] ) {
            /** * Fires when the upgrader has successfully overwritten a currently installed * plugin or theme with an uploaded zip package. * * @since 5.5.0 * * @param string $package The package file. * @param array $data The new plugin or theme data. * @param string $package_type The package type ('plugin' or 'theme'). */
Home | Imprint | This part of the site doesn't use cookies.