Yoast updates delete opcache for non-Yoast and non-WP PHP files

Yoast is unnecessarily interfering with server-wide caching.

Our small team in a higher-ed support role has been chasing server instability issues related to PHP caching for some time. We manage a LAMP environment, with a mix of WP and other web technologies. We have discovered a compellingly strong coincidence of the instability issues with Yoast updates.

Digging into the plugin code, we find line 328 of wp_seo_main.php performing an opcache_reset() inside a version compare conditional.

Github issue 9315 (https://github.com/Yoast/wordpress-seo/issues/9315) has several users requesting that you change this call to a loop through a file list, running opcache_invalidate() on each of your files. A survey of many other plugins installed in our environment shows that this approach is quite popular, while Yoast is the only plugin in our codebase that uses opcache_reset().

The opcache_invalidate() strategy is rejected because “we’d have to keep a list of files”(!) but as many users pointed out in the discussion on that issue, opcache_resets affect far more than just Yoast or even just WordPress. It imposes a performance cost on all PHP on the server, and violates one of the prime directives of WordPress plugin development. It is not a “play nice with others” programming practice, to say the least.

Please reconsider using opcache_invalidate() instead, or at the very least offering a configuration option that allows disabling the opcache_reset() call.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer