Clear 'wp_core_block_css_files' transient on theme activation and refresh
Opened this issue · 3 comments
joemaller commented
For some reason the wp_core_block_css_files
is persisting and preventing the loading of some styles. This has resulted in visual discrepancies between development and production deploys, despite identical code.
Initial thinking is to add the following:
- Delete the transient from the
after_switch_theme
hook, likely as part of ideasonpurpose/wp-theme-init -
Addwp-cli transient delete wp_core_block_css_files
to the bootstrap script - Delete the transient directly from the
wp_options
table when running theme-activate
See also WordPress#59111
Note that wp-config.php hacks didn't work easily, (see #71) and adding define( 'WP_DEVELOPMENT_MODE', 'core' );
didn't fix this issue anyway (as suggested here)
joemaller commented
Delete the transient directly from the DB table:
DELETE FROM `wp_options` WHERE option_name = '_transient_wp_core_block_css_files';
wp-cli command:
wp --allow-root transient delete wp_core_block_css_files
joemaller commented
Delete the transient on theme-activation:
add_action('after_switch_theme', function () {
delete_transient('wp_core_block_css_files');
});
joemaller commented
Escaped shell command from docker-compose.yml:
echo -e "🐛 \033[36mClearing buggy \033[90mwp_core_block_css_files \033[36mtransient\033[0m" &&
mariadb -h db $${MYSQL_DATABASE} \
-e "DELETE FROM wp_options \
WHERE option_name = \"_transient_wp_core_block_css_files\"" &&