Repository navigation
Guard Instant Results facets against invalid taxonomy values - #4255
Merged
felipeelia merged 5 commits intoFeb 6, 2026
Merged
Conversation
felipeelia
requested changes
Jan 9, 2026
felipeelia
left a comment
Member
There was a problem hiding this comment.
@laraib15 thanks for the PR! Do you mind addressing my comment there so we can merge it in 5.3.3?
felipeelia
requested changes
Jan 27, 2026
felipeelia
left a comment
Member
There was a problem hiding this comment.
We're almost there, @laraib15! just this last detail and we should be done
laraib15
force-pushed
the
fix/instant-results-taxonomy-guard
branch
from
January 30, 2026 14:43
ed7f62b to
e80dd18
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the Change
This PR prevents a fatal error in Instant Results taxonomy facets when the
ep_facet_include_taxonomiesfilter returns unexpected values (e.g., a taxonomy slug string such asinternal_tagsrather than aWP_Taxonomyobject).InstantResults::get_facets()currently assumes each filtered taxonomy entry is aWP_Taxonomyobject and passes it directly toget_taxonomy_labels(). If a third-party integration appends a slug string, WordPress core fatals when it tries to treat a string as an object (e.g.,Attempt to assign property "labels" on stringinwp-includes/taxonomy.php).This change adds a defensive guard in the taxonomy facets loop:
get_taxonomy( $slug )WP_Taxonomy, skip itThis prevents wp-admin lockouts while preserving existing behavior for correctly shaped data.
Closes #4254
How to test the Change
internal_tagsas a string viaep_facet_include_taxonomies)./wp-admin//wp-admin/admin.php?page=elasticpressVerified on: WordPress 6.9; PHP 8.4.
Changelog Entry
Credits
Props @laraib15
Checklist: