Plugin / Advanced Custom Routes – Custom Endpoints for WP REST API

Carlile Design

Description

Description

The REST API was a great additional to WordPress that made it easy to grab data through the default routes. The biggest issue with these default routes is it will either grab too much data or too little data and it didn’t make it easy to only grab the data you need. This plugin makes it possible to create custom routes where you can set to pull only the data you need/want. Even better you won’t even have to touch a line of code to make it work, everything will be configurable within the WordPress dashboard.

Features ⚡️

  • Unlimited custom routes
  • Custom route naming
  • Custom filtering to only receive data you need
  • Select which fields to output
  • Query parameters
  • A hassle-free experience

How to use

  1. To start using Advanced Custom Routes, go to the WordPress dashboard and select the Custom Routes section.
  2. Next click ‘Add New’ to create your first custom route.
  3. Give your custom route a name and start configuring your custom route to what you need.
  4. Query Builder Options: Select how to filter the posts you would like to receive at this custom route.
  5. Response Output: Select which fields you would like to receive at this custom route.
  6. Once you have configured everything to your liking, publish the custom route and you will now be able to receive your selected data at this route.

Query Builder Options

  • Posts, Pages, and Custom Post Types
  • Post ID
  • Categories
  • Tags
  • Author
  • Post Parent
  • Status
  • Order & Orderby
  • Date
  • Amount & Offset

Response Output

  • ID
  • Title
  • Content
  • Excerpt
  • Link
  • Slug
  • Date Posted
  • Status
  • Featured Image
  • Categories
  • Tags
  • Author
  • Post Type
  • Template
  • Post Parent
  • Menu Order
  • Custom Fields

Route Parameters

You can also filter your custom routes using query parameters that you add to the end of your custom route like so:

https://example.com/wp-json/custom-routes/v1/posts?id=1

In the example above it would only pull data for that custom route where the post’s ID was equal to 1. This can be used for multiple different query parameters:

  • amount
  • offset
  • page
  • post_type
  • id
  • id_exclude
  • category
  • category_exclude
  • tag
  • tag_exclude
  • author
  • author_exclude
  • post_parent
  • post_parent_exclude
  • status
  • date_before
  • date_after
  • order
  • orderby
  • slug
  • search
  • page

Single Post Route

You can also receive data for a single post at a custom route using either an ID or a Slug, like so:

ID:

https://example.com/wp-json/custom-routes/v1/posts/1

(This would grab the post with an ID of 1 at this custom route)

Slug:

https://example.com/wp-json/custom-routes/v1/posts/hello-world

(This would grab the post with the slug of hello-world at this custom route)

How to install Advanced Custom Routes.

Using WordPress Plugin Directory

Navigate to the ‘Add New’ in the plugins dashboard
Search for ‘Advanced Custom Routes’
Click ‘Install Now’
Activate the plugin on the Plugin dashboard

Uploading it to WordPress

Navigate to the ‘Add New’ in the plugins dashboard
Navigate to the ‘Upload’ area
Select advanced-custom-routes.zip from your computer
Click ‘Install Now’
Activate the plugin in the Plugin dashboard

Via FTP

Download advanced-custom-routes.zip
Extract the advanced-custom-routes directory to your computer
Upload the advanced-custom-routes directory to the /wp-content/plugins/ directory
Activate the plugin in the Plugin dashboard

DIRECTORY DISCLAIMER

The information provided in this THEME/PLUGIN DIRECTORY is made available for information purposes only, and intended to serve as a resource to enable visitors to select a relevant theme or plugin. wpSocket gives no warranty of any kind, express or implied with regard to the information, including without limitation any warranty that the particular theme or plugin that you select is qualified on your situation.

The information in the individual theme or plugin displayed in the Directory is provided by the owners and contributors themselves. wpSocket gives no warranty as to the accuracy of the information and will not be liable to you for any loss or damage suffered by you as a consequence of your reliance on the information.

Links to respective sites are offered to assist in accessing additional information. The links may be outdated or broken. Connect to outside sites at your own risk. The Theme/Plugin Directory does not endorse the content or accuracy of any listing or external website.

While information is made available, no guarantee is given that the details provided are correct, complete or up-to-date.

wpSocket is not related to the theme or plugin, and also not responsible and expressly disclaims all liability for, damages of any kind, arising out of the use, reference to, or reliance on, any information or business listed throughout our site.

Keep Leading Your Followers!
Share it for them.