On this page
wp_clean_themes_cache( bool $clear_update_cache = true )
Clears the cache held by get_theme_roots() and WP_Theme.
Parameters
$clear_update_cachebool Optional-
Whether to clear the theme updates cache.
Default:
true
Source
File: wp-includes/theme.php. View all references
function wp_clean_themes_cache( $clear_update_cache = true ) {
if ( $clear_update_cache ) {
delete_site_transient( 'update_themes' );
}
search_theme_directories( true );
foreach ( wp_get_themes( array( 'errors' => null ) ) as $theme ) {
$theme->cache_delete();
}
}
Related
Uses
| Uses | Description |
|---|---|
| search_theme_directories() wp-includes/theme.php | Searches all registered theme directories for complete and valid themes. |
| wp_get_themes() wp-includes/theme.php | Returns an array of WP_Theme objects based on the arguments. |
| delete_site_transient() wp-includes/option.php | Deletes a site transient. |
Used By
| Used By | Description |
|---|---|
| wp_clean_update_cache() wp-includes/update.php | Clears existing update caches for plugins, themes, and core. |
| WP_Automatic_Updater::run() wp-admin/includes/class-wp-automatic-updater.php | Kicks off the background update process, looping through all pending updates. |
| Theme_Upgrader::current_after() wp-admin/includes/class-theme-upgrader.php | Turn off maintenance mode after upgrading the active theme. |
| Theme_Upgrader::install() wp-admin/includes/class-theme-upgrader.php | Install a theme package. |
| Theme_Upgrader::upgrade() wp-admin/includes/class-theme-upgrader.php | Upgrade a theme. |
| Theme_Upgrader::bulk_upgrade() wp-admin/includes/class-theme-upgrader.php | Upgrade several themes at once. |
Changelog
| Version | Description |
|---|---|
| 3.5.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_clean_themes_cache