Timber Compatibility Issue with Glossary (Premium) Plugin v2.3.0 — Fixed in v2.3.2

Senior WebCoder

🔍 What Went Wrong
After upgrading Glossary (Premium) from v2.2.42 to v2.3.0, many users encountered a critical PHP fatal error:
TypeError: Subscriber::onThePost(): Argument #1 ($post) must be of type WP_Post, Timber\Post given
This occurred because the plugin's Subscriber::onThePost() method enforced a strict WP_Post type hint, while the Timber plugin passes a Timber\Post object via the the_post hook. Since Timber\Post does not inherit from WP_Post, PHP throws a fatal type error.
WordPress.org
💬 Plugin Author Response (Via WordPress Forums)
In the official WordPress.org support thread, a user facing this error received the following from the plugin author:
“The bug is on Timber that is returning to a WordPress filter the wrong data and one of the library we are using is crashing because it is stricter than usual.”
WordPress.org
This confirmed the conflict was due to strict type enforcement on the plugin side interacting poorly with Timber’s object model.
✅ The Fix: v2.3.2 and Beyond
Starting in v2.3.2, the plugin relaxed the onThePost() method signature by introducing a namespaced \WP_Post type hint, which avoids strict enforcement and accepts Timber's post objects:
public function onThePost(\WP_Post $post, \WP_Query $query) {
$this->networkWpQuery->setUpPost($post, $query);
}
This version removed the compatibility barrier, allowing both native WP_Post and wrapper objects like Timber\Post to be passed safely.
📊 Version Compatibility Table
| Glossary Version | Timber Integration Status |
|---|---|
| v2.2.42 and earlier | ✅ Fully Compatible |
| v2.3.0 – v2.3.1 | ❌ Fatal TypeError with Timber |
| v2.3.2 and later | ✅ Compatibility Restored |
🔧 Fix Steps for WordPress Site Admins
- Check your current plugin version via Plugins → Installed Plugins.
- If you're on v2.3.0 or v2.3.1, ensure you update to v2.3.2 or newer.
- Clear caches (e.g., object cache, Timber templates, CDN) to reflect the latest code.
- Re-open pages using
Timber\Post— archive pages or single post pages — to confirm no fatal error occurs.
🧪 Debugging Tips if Error Persists
Enable debugging by adding the following to your wp-config.php file:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
Reproduce the issue and check /wp-content/debug.log for:
onThePost(): Argument #1 must be of type WP_Post, instance of Timber\Post given
For unresolved cases, contact Codeat’s premium support:
https://support.codeat.co/
Provide WordPress version, PHP version, active theme/plugins list, and the error log.
WordPress.org
🧠 Why This Matters to Developers
Using strict type hints in WordPress plugins can create unintended conflicts, especially when interacting with frameworks like Timber that wrap native objects.
Timber\Post is not a subclass of WP_Post, so rigid typing will fail in many common use cases.
This case highlights the importance of avoiding strict typing in hook handlers unless you're certain of object types.
Always test plugin updates in staging environments, particularly when your site uses advanced OOP frameworks.
