Skip to content
Docs
Get RestroPress

Action

rp_ajax_{$action}

Updated
On this page

Fires to run a RestroPress frontend AJAX request.

Runs in RP_AJAX::do_rp_ajax() when the request has an rp-ajax query argument. The dynamic part is the sanitized value of that argument. Core registers its AJAX handlers on this hook for the frontend events, and wp_die() is called after the action. Add a handler to create your own endpoint at the URL given by RP_AJAX::get_endpoint().

Example#

function my_ajax_ping() {
	wp_send_json( array( 'ok' => true ) );
}
add_action( 'rp_ajax_my_ping', 'my_ajax_ping', 10, 0 );

Notes#

No nonce or capability check is done by the dispatcher, so a handler must do its own.

Source#

Fired from:

  • includes/class-rpress-ajax.php (line 76), in RP_AJAX::do_rp_ajax()

See also#

Was this page helpful?