How to use ajax in wordpress?

//How to use ajax in wordpress?
How to use ajax in wordpress? 2018-09-17T22:28:39+05:30
Viewing 1 post (of 1 total)
  • Author
    Posts
  • conveys
    Keymaster
    Post count: 6

    So, if you want it to fire on the front-end for both visitors users and logged-in users, you can do this:

    add_action( 'wp_ajax_my_action', 'my_action_callback' );
    add_action( 'wp_ajax_nopriv_my_action', 'my_action_callback' );

    Example

    add_action( 'wp_ajax_GetPostMedia', 'GetPostMedia' );
    add_action( 'wp_ajax_nopriv_GetPostMedia', 'GetPostMedia' );

    function GetPostMedia(){
    Something here...
    }

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

Rate us
Rated 5.00 out of 5.0 for Conveys Support service by 14 clients on over 15000+ projects.