Created
October 30, 2020 09:18
-
-
Save fedek6/4dc1f34ba363659fab75cf72e1d6fbbb to your computer and use it in GitHub Desktop.
Working WordPress opcache preloading config
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 | |
/** | |
* WordPress opcache preloading. | |
* Requires PHP >= 7.4. | |
* | |
* @author Konrad Fedorczyk <contact@realhe.ro> | |
* @link https://stitcher.io/blog/preloading-in-php-74 | |
* | |
* @version 1.0.0 | |
*/ | |
/** | |
* Uwaga! Adjust your path. | |
*/ | |
define('APP_PATH', '/home/developer/htdocs/oko/'); | |
$preload_patterns = [ | |
// WP native files (priority). | |
'wp-load.php', | |
'wp-includes/http.php', | |
'wp-includes/class-http.php', | |
'wp-includes/general-template.php', | |
'wp-includes/link-template.php', | |
'wp-includes/class-wp-http-response.php', | |
'wp-includes/class-wp-http-requests-hooks.php', | |
'wp-includes/class-wp-http-proxy.php', | |
'wp-includes/class-wp-http-requests-response.php', | |
'wp-includes/class-wp-http-cookie.php', | |
'wp-includes/class-wp-query.php', | |
'wp-includes/class-wp-tax-query.php', | |
'wp-includes/class-wp-user.php', | |
'wp-includes/class-wp-post.php', | |
'wp-includes/class-wp-roles.php', | |
'wp-includes/class-wp-role.php', | |
'wp-includes/taxonomy.php', | |
'wp-includes/post.php', | |
'wp-includes/user.php', | |
'wp-includes/pluggable.php', | |
'wp-includes/rest-api.php', | |
'wp-includes/kses.php', | |
'wp-includes/capabilities.php', | |
'wp-includes/comment.php', | |
'wp-includes/query.php', | |
'wp-includes/l10n.php', | |
'wp-includes/shortcodes.php', | |
'wp-includes/theme.php', | |
'wp-includes/post-template.php', | |
'wp-includes/post-thumbnail-template.php', | |
'wp-includes/media.php', | |
'wp-includes/date.php', | |
'wp-includes/author-template.php', | |
// Rest WP files. | |
"wp-includes/**/*.php", | |
"wp-includes/**/**/*.php", | |
"wp-includes/**/**/**/*.php", | |
"wp-includes/**/**/**/**/*.php", | |
]; | |
foreach ($preload_patterns as $pattern) { | |
$files = glob(APP_PATH . $pattern); | |
foreach ($files as $file) { | |
opcache_compile_file($file); | |
} | |
} |
load-scripts.php?c=1&load%5Bchunk_0%5D=hoverIntent&ver=5.7.1
load-scripts.php?c=1&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=5.7.1
load-styles.php?c=1&dir=ltr&load%5Bchunk_0%5D=dashicons,admin-bar,site-health,common,forms,admin-menu,dashboard,list-tables,edit,revisions,media,themes,about,nav-menus,wp-poi&load%5Bchunk_1%5D=nter,widgets,site-icon,l10n,buttons,wp-auth-check&ver=5.7.1
Status Code: 500
Commented out these 3 files from getting included, and the 500 status code went away for us, and admin area got back CSS styles:
- general-template.php
- link-template.php
- l10n.php
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
WordPress management background format is chaotic