WordPress plugin how to run function when button is clicked

Create form or link with action=”my_media_update” <form action=”<?php echo admin_url(‘admin-post.php’); ?>” method=”post”> <input type=”hidden” name=”action” value=”my_media_update”> <input type=”submit” value=”Update Media Titles and ALT Text”> </form> Add this function and hook in your plugin file: public function kh_update_media_seo() { //update media files title and alt tags here // // at the end redirect to target page … Read more

How can I change the frequency of a scheduled event?

It looks for me that you are adding this event only when there is no such event ‘send_email_alerts_hook’ scheduled yet. Try something like this and let me know if it workded. function shedule_email_alerts() { if ( !wp_next_scheduled( ‘send_email_alerts_hook’ ) ) { wp_schedule_event(time(), ‘daily’, ‘send_email_alerts_hook’); } else { wp_reschedule_event(time(), ‘daily’, ‘send_email_alerts_hook’); } } The thing is … Read more

How to Add a .js file Only in one specific Page Dynamically to Head

Use conditional is_page() for loading script on specific page. Here Is The Modified Version of Your Function: //Load Scripts function load_scripts(){ wp_deregister_script(‘jquery’); // De-register Existing jquery wp_register_script(‘jquery’, ‘http://code.jquery.com/jquery.js’, ”, ”, true); wp_enqueue_script( ‘jquery’ ); wp_register_script(‘bootstrap-jquery’,get_template_directory_uri().’/assets/js/bootstrap.js’, array( ‘jquery’ ), ”, true); wp_enqueue_script( ‘bootstrap-jquery’ ); // register the script wp_register_script( ‘my-script’, ‘URL to Script’ ); // by … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)