1.0.1 • Published 1 year ago

ajax-wp-query v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

AJAX WP_Query

Description

Module to use WP_Query in a WordPress installation through AJAX request

Requirements

For use this module in your WordPress theme or module, you need to install it through npm o yarn

    npm i ajax-wp-query

or

    yarn add ajax-wp-query

Usage

In your WordPress theme or plugin, you should find the functions.php file and add the following code to the end.

function AJAX_WP_Query(){
    wp_send_json($_POST);
}

add_action("wp_ajax_AJAX_WP_Query", "AJAX_WP_Query");
add_action("wp_ajax_nopriv_AJAX_WP_Query", "AJAX_WP_Query");

Then, you can use the AJAX_WP_Query function as below

AJAX_WP_Query(requestData, responseFunction, actionType, wrapperElement, loadingElement)
1.0.1

1 year ago

1.0.0

1 year ago