• Resolved Nikola Nikolov

    (@nikolovtmw)


    Hi there,

    When you register your own scripts or styles within WordPress, it’s not a bad idea to use something more unique to your plugin. For instance, you register your fb.js script with a handle of “myownscript” – not very unique, nor describing of what it is. A better alternative would be something like “fb-pagelike-widget” or “milap-fb-pagelike-widget”. I don’t have an issue with this in particular, but it’s not impossible that someone else decided to name their script “myownscript”, which would make either your or their JS to not be loaded on the site.

    The same thing goes for when using wp_localize_script(). You’re assigning some values to an object called vars(these objects are within the global JS scope, so can be overwritten), which again is not really unique. I have another plugin that does the same thing. The result is that the other plugin breaks.

    So, please with the next version just change at least the second parameter of wp_localize_script() to try and prevent race conditions like this from happening.

    Thank you 🙂

    https://ww.wp.xz.cn/plugins/facebook-pagelike-widget/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Milap

    (@milap)

    Hi Nikola,

    First of all i would like to thank you for suggestion. Yes you are absolutely right, i must have to change mentioned terms in my plugin and i will do it soon. Thanks for taking time to check my plugin code and wrote me.

    This is one of the reasons behind the success of WordPress, because of people like you. God bless you.

    Kind Regards,
    Milap

    Thread Starter Nikola Nikolov

    (@nikolovtmw)

    Glad I was able to help improve your plugin 🙂

    Thank you for working on it and releasing it for everyone to use for free!

    Plugin Author Milap

    (@milap)

    Hi Nikola,

    I have updated both. You can check now in my plugin.
    Again thanks for your suggestions.

    Kind Regards,
    Milap

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

The topic ‘wp_localize_script() conflict’ is closed to new replies.