WP Manifestindependent plugin directory
manifest / developer / rest-api-data-localizer

REST API Data Localizer

Localize a store of normalized WP REST API response data.

by Brandon Shiluk · github.com/bshiluk/rest-api-data-localizer

40stars
15forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/bshiluk/rest-api-data-localizer/archive/refs/heads/master.zip

From the readme

WP REST API Data Localizer Localize a store of normalized WP REST API response data. Useful for sharing data and avoiding initial API requests when using Wordpress and the WP REST API in combination with front-end frameworks like Vue, React, and Angular. Getting Started 1. Upload this repo to your /wp-content/plugins/ directory 2. Activate as you would any other Wordpress plugin Usage Initialize your store - 'mystore' is the name of your localized store - 'scripthandle' is the handle of the script your store will be localized to - 'array()' defines the schema for your store Initialize your store with an endpoint - 'myposts' is the key used to call the endpoint - RADL::endpoint( 'posts' ) initializes an endpoint corresponding to '/wp/v2/posts' Now you can make requests to '/wp/v2/posts' internally. - If the second argument is an array, it is used as the arguments for the request, otherwise it is treated as the unique identifier for a resource at the specified endpoint - The first request is equivalent to GET /wp/v2/posts/?perpage=10 - The second request is equivalent to GET /wp/v2/posts/12 Access WP REST API Data in Templates Preload endpoint in store with res

Read the full README on GitHub →