<em> tags display in autocomplete results
What did you expect to happen?
When searching in autocomplete, I expected tags to display text as italic (due to css styling), but looks like all html tags render as plain text.
What happened instead?
html tags (ie-) display as text and not rendered html.
How can we reproduce this behavior?
search for "r. equi" in the right column search box.
Can you provide a link to a page which shows this issue? http://staging-thehorse.kinsta.com/
Technical info
- WordPress version:5.0.3
- Algolia Search plugin version:2.11.3
👋 This is a little surprising because by default the em tags are not used in the WP plugin.
Did you customize something? Because we have in place a special logic in order to avoid XSS.
There's been no customization that I'm aware of. However, I've been wondering if it has something to do with the highlighting prefix? Looked at it this morning and it's set to <bold>.
By default the plugin should use the prefixes defined here: https://github.com/algolia/algoliasearch-wordpress/blob/master/templates/autocomplete.php#L99
Those are then replace by <em> tags however they should not be escaped again.
Could you compare the code you have with the one of the file linked above?
Maybe you are using an older version that had a different behavior?
Keep me posted,
Ran a text compare, and no differences.
Update: I did a search for anything custom, and we do have a small bit of code in functions.php that is designed not to index pages where the robot index option in the Yoast SEO plugin is set to noindex. Code below: `function filter_post( $should_index, WP_Post $post ) { if ( false === $should_index ) { return false; }
return get_post_meta($post->ID, '_yoast_wpseo_meta-robots-noindex', true) == 1 ? false : true;
}
// Hook into Algolia to manipulate the post that should be indexed.
add_filter( 'algolia_should_index_searchable_post', 'filter_post', 10, 2 );
add_filter( 'algolia_should_index_post', 'filter_post', 10, 2 );
/**
* Dequeue default CSS files.
*
* Hooked to the wp_print_styles action, with a late priority (100),
* so that it is after the stylesheets were enqueued.
*/
function my_theme_dequeue_styles() {
// Remove the algolia-autocomplete.css.
wp_dequeue_style( 'algolia-autocomplete' );
}
add_action( 'wp_print_styles', 'my_theme_dequeue_styles', 100 );`
Could this be having an effect?
I don't think the above could affect the output.
Could you confirm that you do not have a custom autocomplete.php implementation in your theme?
Correct. We do NOT have a custom autocomplete.php implementation. Code comparison was identical.