-
Notifications
You must be signed in to change notification settings - Fork 821
Inline Search: Address Blaskan theme body class conflict with inline highlighter #43797
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
Inline Search: Address Blaskan theme body class conflict with inline highlighter #43797
Conversation
This commit addresses the Blaskan theme fatal by moving away from body_class() based checking, to theme name and theme template checking. We use this to return the $title early in filter_highlighted_title(), both for the Blasken theme, and p2020, which loads o2 as a plugin and which calls the_title filter incorrectly (which previously caused its own fatal).
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Search plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
return $title; | ||
$incompatible_themes = array( | ||
'blaskan', // Blaskan incorrectly uses wp_nav_menu() in body_class filter, causing infinite recursion. | ||
'p2020', // P2 loads o2 as a plugin, which calls the_title() filter incorrectly. |
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.
o2
is loaded as a plugin on P2, so I'm excluding instead on the basis of p2020
as the active theme. I don't think we need to include o2
separately, and even Blaskan
is old enough that ehhh... But this should be a more robust approach, regardless.
Code Coverage SummaryCoverage changed in 1 file.
Full summary · PHP report · JS report Coverage check overridden by
Coverage tests to be added later
|
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.
I've tested this by overriding should_replace_classic_search
and checked how results are getting highlighted for a couple of themes, mentioned in the test instructions. Everything worked as described. LGTM.
Fixes p1749054774731169-slack-C081BEZPLAZ
Proposed changes:
This PR moves away from the
body_class
detection approach introduced in #43511, and moves instead to theme detection usingwp_get_theme()
. While this approach worked for its intended purpose, it seems there are themes that call thebody_class
filter incorrectly, such as earlier versions of the Blaskan theme:https://themes.trac.wordpress.org/browser/blaskan/2.6.6/functions.php#L285
Other information:
Jetpack product discussion
N/A
Does this pull request change what data or activity we track or use?
N/A
Testing instructions:
add_filter( 'jetpack_search_replace_classic', '__return_true', 20 )
; somewhere (e.g. using theCode Snippets
plugin) or add an earlyreturn true
toshould_replace_classic_search()
.Twenty Twenty Four
) and Classic themes (e.g.Dara
), that usethe_excerpt()
andthe_title()
to return search results.Twenty Twenty Five
returns search results usingthe_concent()
, and this is not compatible with highlighting at this point.class-inline-search-highlighter.php
.<mark>
tags in the title. Highlighting is not expected to function on P2 at this point.