Delete Plugin Options with Verify

There are various opinions on this, but generally, if you’re “deleting” (as opposed to simply “deactivating”), you don’t necessarily need to confirm it. However, you certainly could. The general approach to that is to include a setting to remove all settings upon delete or not. Let’s say it’s a checkbox in the plugin’s settings to … Read more

delete category on plugin deactivation wordpress

You should save that category id in option table instead of set as global. Try below code which is helps you to delete that category on deactivation hook. function add_category_on_activation(){ $wpdocs_cat = array(‘cat_name’ => ‘Event Category’, ‘category_description’ => ‘An Event Category to show all events’, ‘category_nicename’ => ‘events’, ‘category_parent’ => ”); $wpdocs_cat_id = wp_insert_category($wpdocs_cat); if($wpdocs_cat_id) … Read more

Load script on frontend from widget plugin

In general to load css or js into admin you need to use admin_enqueue_scripts hook, so it can be like this in functional style: add_action( ‘admin_enqueue_scripts’, function( $hook_suffix ){ wp_enqueue_style(‘i-widget’, plugins_url( ‘i-widget.min.css’ , __FILE__), array(), null); wp_enqueue_script(‘swiper’, plugins_url( ‘swiper.min.js’, __FILE__), array(‘jquery’), null); }, 99 ); wp_enqueue_script(‘i-widget’, plugins_url( ‘i-widget.min.js’, __FILE__), array(‘jquery’, ‘swiper’), null); }, 99 ); … Read more

Uncaught Error: Call to undefined function wp_get_current_user() in

You have to call TopAuthor() function in plugins_loaded orinit action. You are getting Fatal error: Uncaught Error: Call to undefined function wp_get_current_user() because wp_get_current_user() is a pluggable function. You can not call when your plugin is included. You have to wait for the action plugins_loaded or init. Call your TopAuthor() function using init or plugins_loaded … Read more