Override Plugin Script Fucnction in WordPress


I don’t know how to remove a specific function from a plugin.

My plugin is Photo-gallery.

I want to remove this function:

function spider_createpopup(url, current_view, width, height, duration, description, lifetime, lightbox_ctrl_btn_pos){

from the file wp-contentpluginsphoto-galleryjsbwg_gallery_box.js

I’ve tried many things but nothing worked. Last thing i tried in my function.php is :

add_action('wp_enqueue_scripts', 'wp_deregister_script2', 100);

function wp_deregister_script2( ) {
  _wp_scripts_maybe_doing_it_wrong( bwg_gallery_box , bwg_gallery_box );

    wp_scripts()->remove( bwg_gallery_box );

But it’s removing more than just spider_createpopup()

How can I do that?

Edit: I want to remove this function in some conditions, for example if the user in not logged in, so he can’t use all the fonctionality of the plugin to see more pictures in the page.

Ioflvoe89 2 months 0 Answers 12 views 0

Leave an answer