0

I write a basic plugin with custom css/js. I use wp_enqueue_script for my custom script and use hook 'init' to register script in front-end page. But wordpress load this javascript file two times with different version. ( See in image ) And I don't know why. I load this script one time and load it in one point of my code.

I have tried clean cache wordpress, cache browser, but nothing do. custom-addon.js?ver=5.9 and custom-addon.js

My site is esposte online : https://node.alfonsosomma.it/2022/02/04/articolo-prova/ I write plugin to use add_shortcode function to create form; shortcode for the form in this page (articolo-prova).

Best regards,

3
  • On your site's source code I can see two places where custom-addons.js is enqueued one in head and one in footer. Best thing you can do is search for "custom-addons.js" in your code base and see where it is being enqueued.
    – SDahal
    Feb 10 at 18:40
  • 2
    based on the script tags there is a script tag with the ID custom-addons-js-js and another with custom-addons-js, it's likely that you've made a mistake somewhere and registered it twice with slightly different handles, aka custom-addons and custom-addons-js. Where you've done this however is unclear as we don't have access to your code. Also there is no code for the shortcode you mentioned and you haven't shared the name of the plugin you used
    – Tom J Nowell
    Feb 10 at 18:46
  • Ty for response, I find another hook custom-addons in my plugin and it's problem. Thank you so much for support
    – tecnico57
    Feb 10 at 20:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy