-
-
Notifications
You must be signed in to change notification settings - Fork 64
Fix: Add defensive checks for Slim SEO plugin compatibility #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Add defensive checks for Slim SEO plugin compatibility #159
Conversation
vuckro
commented
Aug 9, 2025
- Add null checks in UI element output methods
- Prevent errors when site/membership objects are null
- Ensures compatibility with Slim SEO plugin that calls output() directly
- Defensive programming approach for robustness
79dfc67 to
8e25460
Compare
|
What is it about Slim SEO that makes that properties null? Ideally any compatibility code would only be loaded if the Slim SEO plugin was loaded. In this case it does seem to make sense to just have defensive programming. However would it be possible to create get_site() and get_membership() methods to lazy load then objects if they are not already set? Such a pattern should allow output to always behave the same way. |
|
I'm trying to update with the recommendations quickly. |
|
I just updated the code following your recommendations. Let me know if everything is correct or if you see any other improvements. |
|
Now that I see the problem I think you just need to call this function See https://github.com/superdav42/wp-multisite-waas/blob/main/inc/compat/class-elementor-compat.php for how a class is setup to fix a similar problem in elementor. Particularly this line: If the preview is setup correctly none of the other code changes in the other files will be necessary and they will show appropriate preview data. You should make a single class like Bricks_Compat which will keep all the code in once place. |
02dedce to
a44b8ac
Compare
Add null checks in UI element output() methods to prevent errors when Slim SEO processes shortcodes before WP Ultimo is fully initialized. This fixes the 'Call to a member function get_active_site_url() on null' error by returning empty string instead of attempting to access null objects. Changes: - Add defensive checks in 5 UI elements output() methods - Return empty string when site/membership objects are null - Prevents fatal errors during Slim SEO's shortcode processing Files modified: - inc/ui/class-account-summary-element.php - inc/ui/class-billing-info-element.php - inc/ui/class-current-site-element.php - inc/ui/class-invoices-element.php - inc/ui/class-limits-element.php
a44b8ac to
de3dca1
Compare
|
Thanks for the feedback and explanations. I don't think Bricks is the problem (same error with only Slim SEO active + Multisite Ultimate). Also, the approach with a compatibility class causes problems in my tests. Hoping to hear back on this slim seo issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, this is simple enough to mitigate the bug that's in seo slim. I'm adding these _doing_it_wrong so it's obvious to a developer that something isn't working right, otherwise it may take some extensive troubleshooting to figure why the output is blank
|
@superdav42 It seems that the merge did not completely resolve the issue with my first code proposal:
Can you take a look? I can create a temporary site if necessary. Also following this issue #232, but no response for now |
…lements This addresses David's feedback in PR Multisite-Ultimate#159 to include the version parameter in all _doing_it_wrong() calls for better debugging when Slim SEO processes shortcodes before WP Ultimo is fully initialized.

