Version of jQuery In WordPress Failing Security Audit

You can add the following in your functions.php file to deregister the old included jQuery and register the new jQuery. Using a newer version of jQuery might make some plugins stop working, so you’ll have to check to see if all your plugins will work with the newer version. function mytheme_register_scripts() { wp_deregister_script( ‘jquery’ ); … Read more

Ajax Call not Working in Plugin

You need to add the ajax callback action on your plugin file or themes functions.php like as below: add_action( ‘wp_ajax_fetch_data’, ‘fetch_data_callback’ ); add_action( ‘wp_ajax_nopriv_fetch_data’, ‘fetch_data_callback’ ); then you need to put all the featch_data.php code inside the callback function ‘fetch_data_callback’ like as below: function fetch_data_callback(){ //your function code goes here wp_die() // need to add … Read more

How to properly enqueue jQuery knob on WordPress without conflict?

If you want to just enqueue a script by name then you have to register it first with wp_register_script: wp_register_script( ‘jquery-knob’, plugins_url( ‘assets/js/jquery.knob.min.js’, __FILE__ ), array( ‘jquery’ ), ‘1.2.11’ ); : wp_enqueue_script( ‘jquery-knob’ ); However that’s only really useful when you’re registering a script to be available as a dependency for other scripts, which I … Read more

wordpress file upload from direct directory not working

I fix this problems with wordpress file upload method: php file: add_action( ‘wp_ajax_file_upload’, ‘file_upload_callbacks’ ); add_action( ‘wp_ajax_nopriv_file_upload’, ‘file_upload_callbacks’ ); function file_upload_callbacks() { $arr_img_ext = array(‘application/pdf’); if (in_array($_FILES[‘file’][‘type’], $arr_img_ext)) { $upload = wp_upload_bits($_FILES[“file”][“name”], null, file_get_contents($_FILES[“file”][“tmp_name”])); //$upload[‘url’] will gives you uploaded file path //var_dump($upload[‘url’]); wp_send_json( $upload[‘url’] ); } wp_die(); }