Support » Plugin: VikBooking Hotel Booking Engine & PMS » Admin scripts are always loaded

  • VikBooking scripts are loaded everywhere in the wp-admin.

    I don’t know if they are really necessary everywhere in the admin but they do conflict and break other plugins that use the same scripts (intlTelInput or select2).

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

    (@e4jvikwp)

    Hello,

    In order to support browser/desktop notifications, Vik Booking voluntarily loads just a few CSS/JS assets in the wp-admin pages. The whole list of required assets are only loaded inside the wp-admin pages of Vik Booking.

    Moreover, every admin-widget of Vik Booking gets pre-loaded, and so if an admin-widget requires a specific JS asset, then this will be loaded as well. This is done to support browser notifications and their related actions (clicks) on any wp-admin page.

    However, we enqueue the scripts through the WordPress native functions, but we actually don’t initialize any third party plugin such as Select2 or intlTelInput. This means that if the other plugins on your website were loading the same assets through WordPress, no conflicts could ever be possible. It is not like we reset jQuery UI by reloading it statically, we simply do it through the WordPress native functions without ever invoking such JS helpers. Therefore, no settings should be harmed.

    We believe the conflicts you are having are caused by the fact that the other plugins are not enqueuing their JS assets correctly through the WordPress native functions. Our suggestion is to check the source code of the pages showing conflicts, and eventually contact also the other plugin developers.

    As an alternative solution, there’s a way to stop Vik Booking from loading certain admin-widgets by registering a specific hook documented on our website to “unload” some admin-widgets. However, by doing so, your wp-admin section would no longer support browser/desktop notifications unless you are inside a page of Vik Booking.

    The VikWP Team

    Thread Starter Pacotole

    (@pacotole)

    As I said in the initial message, I don’t know if they are really necessary, but if they are not, it is not a good practice to always load them because it can create conflicts.

    These libraries (intlTelInput and select2) have global settings that can be different for each plugin (eg WooCommerce uses select2 when editing a product).

    I attach some examples with the VikBooking’s js/css that are loaded in all wp-admin pages:

    Plugin Author e4jvikwp

    (@e4jvikwp)

    Hi,

    Thanks for the screen shots. The JS in your browser console are the expected and necessary ones to dispatch browser notifications on any wp-admin page, as well as to be able to render the admin-widgets (for example, after clicking on a browser/toast notification for a guest message received through Booking.com or Airbnb – for those who also use our E4jConnect Channel Manager service together with Vik Booking).

    What we would like to understand is what kind of conflicts you have for example with WooCommerce when editing a product. If loading the JS library will reset any global settings defined by WooCommerce or any other plugin, then the issue is clear.

    What we can tell you for the moment is that we can consider adding a simple hook to prevent the system from loading such assets on certain pages. A custom plugin or a custom hook could simply detect the current page and maybe tell Vik Booking not to load those assets.

    That’s a fundamental feature for the majority of our clients, and the assets you see are indeed necessary. As you’ve noticed, we are not loading useless assets such as the main CSS file of Vik Booking, and so we are not being invasive. Those who use additional plugins that rely on Select2 or intlTelInput can simply stop Vik Booking from loading those assets on the pages of WooCommerce, for example. We will discuss the situation internally with our colleagues.

    Thank you,
    The VikWP Team

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Admin scripts are always loaded’ is closed to new replies.