Roots Discourse

Bug in script_loader_tag filter (when using Elementor)

Hi,

there is a bug/conflict in the Soil plugin, in the script_loader_tag filter.

With this filter is enabled, the Elementor page builder, which I use in my theme, fails to load, only when the title of the page being edited contains an apostrophe (single quote mark).

This is because the soil script_loader_tag filter replaces single quotes by double quotes in every tag, which gives the following script tag (I’ve kept only relevant code showing the issue):

<script type="text/javascript">
var elementorFrontendConfig = {"post":{"id":2583,"title":"SandBox NE PAS L"EFFACER","excerpt":""}};
</script>

The issue is in the title prop of the JSON object: the double quote before EFFACER.

Hi there! Do you have a Soil license? I didn’t see your email address in our database

This should work for now:

add_action('wp_print_scripts', function() {
  remove_filter('script_loader_tag', 'Roots\\Soil\\CleanUp\\clean_script_tag');
});

This topic was automatically closed after 42 days. New replies are no longer allowed.