Category: Advance

How to Create Custom Get Rest Api In WordPress

The WordPress Has In build Rest Api and Also Provides End Points To Create A Rest Api in word press are 1 :Get Methods //End point is : http://wpdadd.com/wp-json/api/v1/getwpdaddstaff   add_action( 'rest_api_init', function () {     register_rest_route( 'api', '/v1/getwpdaddstaff', array(     'methods' => 'GET',     'callback' => 'wpdaddStuff',     ));  

How To Use AJAX In WordPress in Three Simple Steps

Step 1: First we need to Add JQuery Script And Need to Initial Ajax Variable Global as shown below add_action( 'init', 'ajax_script_enqueuer' );   function ajax_script_enqueuer() { wp_register_script( "ajax_script", WP_PLUGIN_URL.'/your_plugin/script.js', array('jquery') ); wp_localize_script( 'ajax_script', 'ajaxuse', array( 'ajaxurl' => admin_url( 'admin-ajax.php' )));   wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'ajax_script' );   }add_action( 'init', 'ajax_script_enqueuer' ); function ajax_script_enqueuer()