If this gives you any clue, in the source of the “offending” template (when it has been the result of a search, and the query string has been duly appended, such as ?hilite=zebra
), the content of the script is basically repeated, so it looks like:
<script id='hlst-extend-js-after'>
/* Highlight Search Terms 1.6.1 ( RavanH - https://status301.net/wordpress-plugins/highlight-search-terms/ ) */
const hlst = function() {
window.hilite(["zebra"], ["#groups-dir-list", "#members-dir-list", "div.bbp-topic-content,div.bbp-reply-content,li.bbp-forum-info,.bbp-topic-title,.bbp-reply-title", "article", "div.hentry", "div.post", "div.wp-block-query", "#content", "#main", "div.content", "#middle", "#container", "div.container", "div.page", "#wrapper", "body"], true, true)
};
window.addEventListener('DOMContentLoaded', hlst);
window.addEventListener('post-load', hlst);
/* Highlight Search Terms 1.6.1 ( RavanH - https://status301.net/wordpress-plugins/highlight-search-terms/ ) */
const hlst = function() {
window.hilite(["zebra"], ["#groups-dir-list", "#members-dir-list", "div.bbp-topic-content,div.bbp-reply-content,li.bbp-forum-info,.bbp-topic-title,.bbp-reply-title", "article", "div.hentry", "div.post", "div.wp-block-query", "#content", "#main", "div.content", "#middle", "#container", "div.container", "div.page", "#wrapper", "body"], true, true)
};
window.addEventListener('DOMContentLoaded', hlst);
window.addEventListener('post-load', hlst);
</script>
So the function gets called twice and the same variable gets declared twice.
But maybe you realised all that.
I can’t think why the function should be repeated like that.