v1.4.18 breaks search
-
Updating to 1.4.18 caused search to break on my site; downgrading to 1.4.17 resolves the issue. It appears to be a conflict with Relevanssi, as deactivating that also resolves the issue.
Here’s the abridged stack trace:<b>Fatal error</b>: Uncaught Error: Object of class stdClass could not be converted to string in /Users/bbyrne/Local Sites/nanostring-prod/app/public/wp-content/plugins/modern-footnotes/modern-footnotes.php:293
Stack trace:#0 /Users/bbyrne/Local Sites/nanostring-prod/app/public/wp-content/plugins/modern-footnotes/modern-footnotes.php(262): modern_footnotes_get_post_scope_id()#1 /Users/bbyrne/Local Sites/nanostring-prod/app/public/wp-includes/class-wp-hook.php(324): modern_footnotes_reset_count('\n<h2 class="wp-...')#2 /Users/bbyrne/Local Sites/nanostring-prod/app/public/wp-includes/plugin.php(205): WP_Hook->apply_filters('\n<h2 class="wp-...', Array)#3 /Users/bbyrne/Local Sites/nanostring-prod/app/public/wp-content/plugins/relevanssi-premium/lib/excerpts-highlights.php(140): apply_filters('the_content', '<!-- wp:heading...')#4 /Users/bbyrne/Local Sites/nanostring-prod/app/public/wp-content/plugins/relevanssi-premium/lib/excerpts-highlights.php(1644): relevanssi_do_excerpt(Object(stdClass), 'cancer', '30', 'words')#5 /Users/bbyrne/Local Sites/nanostring-prod/app/public/wp-content/plugins/relevanssi-premium/lib/search.php(699): relevanssi_add_excerpt(Object(stdClass), 'cancer')#6 /Users/bbyrne/Local Sites/nanostring-prod/app/public/wp-content/plugins/relevanssi-premium/lib/search.php(88): relevanssi_do_query(Object(WP_Query))
In debugging this myself, it looks like what’s in$GLOBALS['post']
after Relevanssi is done with it is no longer an instance ofWP_Post
, but rather a basicstdClass
, which causesmodern_footnotes_get_post_scope_id()
to fail to set$global_post_id
to an integer, instead leaving it as a class.
Might be better to change the logic inmodern_footnotes_get_post_scope_id()
to check if$global_post
is an integer first, then check if it’s a(ny) class having a property ofID
, rather than assuming it will always be either an integer or a WP_Post? (Honestly, I’d say Relevanssi should be doing a better job of making sure what’s in$GLOBALS['post']
is a post object, too….)
- The topic ‘v1.4.18 breaks search’ is closed to new replies.