Enqueue script in plugin is not working

Two reasons your code is not working. 1. Handle should be same i.e. ‘follow’ where as you are using the_follow and follow. 2. You have to execute statements in sequence i.e.(not sure) a) Register Script b) Localize Script c) Enqueue Script Ref: wp_localize_script // Register the script wp_register_script( ‘follow’, plugins_url(‘the-follow.js’, __FILE__) ); // Localize the … Read more

how to make custom ajax handler?

You have to include WP core function files, something like this… <?php //mimic the actuall admin-ajax define(‘DOING_AJAX’, true); if (!isset( $_POST[‘action’])) die(‘-1’); //make sure you update this line //to the relative location of the wp-load.php require_once(‘../../../../../wp-load.php’); //Typical headers header(‘Content-Type: text/html’); send_nosniff_header(); //Disable caching header(‘Cache-Control: no-cache’); header(‘Pragma: no-cache’); You can read more about this here https://coderwall.com/p/of7y2q/faster-ajax-for-wordpress … Read more