Home Forums Bug Reports ACF Tabs not showing under pagesspeed module Reply To: ACF Tabs not showing under pagesspeed module

  • Just a comment for people looking for anything similar. Please not that I am not the developer of ACF or do I have first hand knowledge of the module mentioned in the OP.

    The main problem with when things that combine scripts into a single file break a site is that they fail to take into account the use of localizing scripts in WP. Many plugins, including ACF rely on this localization to work.

    When a script is localized WP adds something similar to this just before the line that loads the JS file

    <script type="text/javascript">
    /* <![CDATA[ */
    var adminCommentsL10n = {"hotkeys_highlight_first":"","hotkeys_highlight_last":"","replyApprove":"Approve and Reply","reply":"Reply","warnQuickEdit":"Are you sure you want to edit this comment?\nThe changes you made will be lost.","warnCommentChanges":"Are you sure you want to do this?\nThe comment changes you made will be lost.","docTitleComments":"Comments","docTitleCommentsCount":"Comments (%s)"};
    /* ]]> */

    The above is a WP localization for /wp-admin/js/edit-comments.js
    This localized data must appear before the effected script is included in many cases because the script depends on these values to work properly.

    In other cases the combination does take this into account but it will minify this example code to a single line, which will also break the code because the CDATA tags need to be their own separate lines.

    Another thing that could break sites is that a tiny error in one JS file, when minified, could cause an error that breaks all of the scripts that are included after it.