2024 Kinsta PHP Benchmarks

Kinsta have evaluated of the most popular PHP content management systems (including WordPress) and frameworks using multiple PHP versions including recently released PHP 8.3.

It is well worth reading to take in all the details but a few highlights are CodeIgniter 4, my favourite framework achieving 1684 requests per second.

WordPress and WooCommerce weren’t so great but then you shouldn’t be choosing WordPress for speed, it’s advantages are that it’s easy to use and the third party themes and plugins make it inexpensive to get a rich website created quickly.

https://kinsta.com/blog/php-benchmarks/

CodeIgniter 4 hide the Debug Toolbar for certain routes

To hide the debug toolbar for a certain route, edit Config/Filters.php and add  a new constructor at the bottom of the file containing the following

public function __construct()
{
    if (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], 'your_URL_here')) unset($this->globals['after'][0]);
}

WordPress custom page type pagination 404

During development if you get a 404 when trying to paginate with a custom post type there may be a simple explanation.

If there is a page with the same name as the custom post type the permalink rewrite rules will get confused e.g. a page called books and a custom post type with post_type key books. The solution is to name the custom post type key with the singular version, then it’s fine.

Prevent WordPress showing notice errors

When you are working with an older site it may be necessary to prevent notice level errors from appearing in the error log so that you aren’t swamped with too many messages.

Adding code to wp-config.php doesn’t work because WordPress itself tries to set the error level.

Instead create a ‘must use’ plugin and add the following:

error_reporting(E_ALL & ~E_NOTICE);