Download the PHP package boxybird/boxybird-wp-query-endpoint without Composer

On this page you can find all versions of the php package boxybird/boxybird-wp-query-endpoint. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package boxybird-wp-query-endpoint

WP_Query as a REST API Endpoint

Query anything you want from the WordPress database using a single REST API endpoint.

Simply put, this plugin allows to pass GET params from a url into the WP_Query class as $args

WP_Query Reference: https://developer.wordpress.org/reference/classes/wp_query/

wp_query in javascript

Installation

Clone or Download plugin and run composer install before activating in WordPress Admin.

Usage Examples

PHP

Normally in a WordPress theme or plugin you would create an array of $args and pass them into the WP_Query($args) constructor. Like this:

Using this plugin, you can pass those same args from your front-end Javascript:

Vanilla JS

jQuery

Hooks

The examples below will use a hypothetical site with a 'movie' post_type.

Formatting the JSON response

Out of the box, WP_Query will return the raw rows from the wp_posts table. Like this:

The above may be useful in some situations, but more often than not you'll likely want to format the JSON response. This is the filter to do it:

Here's an example of how you could use the filter:

Focusing on the 'movie' post_type above, this would be the custom formatted response:

Default/Overriding WP_Query Args

Default Args

If you would like to add default WP_Query $args BEFORE the request params are applied, this is the filter to do it.

Note: The above are defaults only. Meaning, if the incoming request specifies posts_per_page, it will override the boxybird/query/default-args filter defaults.

Override Args

If you would like to modify/remove incoming request params BEFORE running the WP_Query, this is the filter to do it.

Note: The above filter can be thought of as a security layer. If you never want an $arg to be passed to WP_Query, do it here!

Permissions Callback

If you would like to protected who has access to the /wp-json/boxybird/wp-query/v1/args endpoint, this is the filter.

Reference: https://developer.wordpress.org/rest-api/extending-the-rest-api/routes-and-endpoints/#permissions-callback


All versions of boxybird-wp-query-endpoint with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package boxybird/boxybird-wp-query-endpoint contains the following files

Loading the files please wait ....