如果已安装WP-CLI,请尝试运行wp cache flush
或
您可以将此代码放入函数中。php
function fix_template_caching( WP_Screen $current_screen ) {
if ( ! in_array( $current_screen->base, array( \'post\', \'edit\', \'theme-editor\' ), true ) ) {
return;
}
$theme = wp_get_theme();
if ( ! $theme ) {
return;
}
$cache_hash = md5( $theme->get_theme_root() . \'/\' . $theme->get_stylesheet() );
$label = sanitize_key( \'files_\' . $cache_hash . \'-\' . $theme->get( \'Version\' ) );
$transient_key = substr( $label, 0, 29 ) . md5( $label );
delete_transient( $transient_key );
}
add_action( \'current_screen\', \'fix_template_caching\' );
参考号:
Fix for theme template file caching https://gist.github.com/westonruter/6c2ca0e5a4da233bf4bd88a1871dd950希望这有帮助!
:)