Last active
November 24, 2023 08:53
-
-
Save joemcgill/dd569c287013ad545f41495f93d7a27e to your computer and use it in GitHub Desktop.
WP 6.4 Theme Path Fixer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Plugin Name: WP 6.4 Theme path fixer | |
* Plugin URI: https://gist.github.com/joemcgill/dd569c287013ad545f41495f93d7a27e | |
* Description: Fix problems with theme directory memoization in WP 6.4. | |
* Version: 1.0 | |
* Requires at least: 6.4 | |
* Author: Joe McGill | |
* Author URI: https://joemcgill.net | |
* License: GPL v2 or later | |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html | |
*/ | |
// Reset template and stylesheet paths prior to theme setup. | |
add_action( 'setup_theme', function () { | |
$GLOBALS['wp_template_path'] = null; | |
$GLOBALS['wp_stylesheet_path'] = null; | |
} ); | |
// Add a noop filter to bypass future memoization. | |
add_filter( 'stylesheet_directory', function ( $dir ) { | |
return $dir; | |
} ); | |
// Add a noop filter to bypass future memoization. | |
add_filter( 'template_directory', function ( $dir ) { | |
return $dir; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment