/srv/www/example.com/current/web/app/themes/sage * get_stylesheet_directory() -> /srv/www/example.com/current/web/app/themes/sage * locate_template() * ├── STYLESHEETPATH -> /srv/www/example.com/current/web/app/themes/sage * └── TEMPLATEPATH -> /srv/www/example.com/current/web/app/themes/sage/templates */ if (App\config('sage.disable_option_hack')) { return; } add_filter('template', function ($stylesheet) { return dirname($stylesheet); }); if (basename($stylesheet = get_option('template')) !== 'templates') { update_option('template', "{$stylesheet}/templates"); wp_redirect($_SERVER['REQUEST_URI']); exit(); }