1

When a WordPress page editor plugin is activated (WP Bakery) I get the console errors on a page using the shortcode [civicrm component="profile" gid="14" mode="create" hijack="0"].

The script from “https://example.org/civicrm/?page=CiviCRM&q=civicrm/ajax/l10n-js/en_US&cid=13243&r=nPFxX” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type.

SyntaxError: expected expression, got '<' on line one of the dcocument

The page uses the Classic editor, not WPBakery. I've tried various plugins to disable the WP Bakery plugin on that one page, with no luck.

Disabling WP Bakery for the whole site allows the shortcodes to work; but it can't be deactivated due to client usage. I'm also trying to work with WP Bakery support.

As a result of the errors, no CiviCRM search results are returned.

Any ideas?

No errors in any WP or CiviCRM error logs.

Going directly to the URL of the Javascipt doesn't load the script, but loads the entire page.

Is it possible to enqueue the CiviCRM script in the footer or change its load order to help troubleshoot?

8
  • What do you see when you visit that example.org url on its own? It's expecting a javascript script but is getting html.
    – Demerit
    Nov 13, 2019 at 17:53
  • When going directly to that URL, I get the full page; that's the error. Nov 13, 2019 at 18:15
  • When you go to the url in your post that has ajax/l10n etc in it?
    – Demerit
    Nov 13, 2019 at 18:24
  • Yes, the complete URL; but no console errors. Nov 13, 2019 at 18:26
  • This usually means there's a PHP error of some kind - instead of returning valid Javacript, the return is a HTML error page. Check your WordPress and CiviCRM logs. Nov 14, 2019 at 17:02

1 Answer 1

1

The problem was WP Bakery and how it hijacks the page; getting rid of WP Bakery for a simpler page editor was the solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.