• Hi, I am developing a plugin which uses Fancybox jQuery plugin. For completeness, I am including the Fancybox script in the plugin package. However, I don’t want to load id from my plugin if it is already loaded by something else.

    Effectively, I want to make sure that Fancybox isn’t added multiple times.

    Is there a way that I can find out what scripts are already in the script queue (from wp_enqueue_script) in order to prevent loading the script multiple times?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Anonymous User

    (@anonymized-3085)

    if it has been loaded via wp_enqueue_script then it will only get loaded once – even if added multiple times.

    Thread Starter voidtrance

    (@voidtrance)

    I am not entirely sure that is true. If two different plugins load the Fancybox jQuery javascript file but they give it different tags (argument 1 to wp_enqueue_script), how would wp_enqueue_script know that it is the same thing?

    Of course, I as type this, I am realizing that there really isn’t a way to have a fool-proof way to get what I want done.

    I am trying to get around the fact that the Fancybox for WordPress plugin and my plugin include two different version of the Fancybox javascript which conflict with each other.

    Anonymous User

    (@anonymized-3085)

    test it… probably the only way you will know for sure.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Enqueueing scripts only if not in queue already’ is closed to new replies.