skip to Main Content

I have to add a JavaScript function on a button click inside a plugin, i’ve tried but every time i update the plugin the function get removed how can i add permanently the function?

2

Answers


  1. There are plugins that allow you to add code that won’t be erased on upgrade. This is one.

    If you have many customizations, you may want to consider creating your own plugin

    Login or Signup to reply.
  2. You should disable the plugin update using filter.

    add_filter('site_transient_update_plugins', 'remove_update_notification');
    function remove_update_notification($value) {
         unset($value->response[ plugin_basename(__FILE__) ]);
         return $value;
    } 
    

    Because everytime you update the plugin it will replace the plugin files with new one.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search