Skip to main content
added 188 characters in body
Source Link

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-content\plugins\photo-gallery\js\bwg_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.

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-content\plugins\photo-gallery\js\bwg_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?

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-content\plugins\photo-gallery\js\bwg_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.

Source Link

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-content\plugins\photo-gallery\js\bwg_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?