Rank Math Compatibility Solution Fix
-
Below is a complete, copy-paste friendly solution you can post on the plugin forum. It explains the cause + gives the exact fix and rollback steps. ✅ Fix: Rank Math update causes fatal error in CF Images (
MyThemeShop\Helpers\Strnot found) Symptoms / ErrorAfter updating Rank Math, the site starts throwing a fatal error like:
PHP Fatal error: Uncaught Error: Class "MyThemeShop\Helpers\Str" not found .../wp-content/plugins/cf-images/app/integrations/class-rank-math.php on line 229Why it happensThe CF Images plugin has a Rank Math integration that still calls the old Rank Math / MyThemeShop namespace:
MyThemeShop\Helpers\Str
Newer Rank Math versions no longer provide that class under the MyThemeShop namespace, so CF Images crashes when it tries to use it. ✅ Quick Recovery (optional)
If your site is down and you need it back immediately:
- Deactivate CF Images from WP Admin, or
- Rename the folder:
/wp-content/plugins/cf-images→/wp-content/plugins/cf-images.disabledOnce the site is back, apply the permanent fix below. ✅ Permanent Workaround (no core plugin edits): MU-Plugin Shim
This solution keeps Rank Math + CF Images working without editing plugin files, so it won’t get overwritten by updates. Step 1 — Create the MU-Plugins folder (if needed)
Create this folder:
/wp-content/mu-plugins/Step 2 — Create a shim fileCreate this file:
/wp-content/mu-plugins/rankmath-mythemeshop-shim.phpStep 3 — Paste this code inside<?php /** * Rank Math compatibility shim for plugins still referencing MyThemeShop namespace. * * Fixes fatal: Class "MyThemeShop\Helpers\Str" not found * Caused by CF Images calling the old class after Rank Math namespace changes. */ add_action('plugins_loaded', function () { // If the old class is missing but the new Rank Math class exists, alias it. if ( ! class_exists('MyThemeShop\\Helpers\\Str') && class_exists('RankMath\\Helpers\\Str') ) { class_alias('RankMath\\Helpers\\Str', 'MyThemeShop\\Helpers\\Str'); } }, 20);Step 4 — Refresh the siteThe fatal error should be gone immediately.
You must be logged in to reply to this topic.