Contributors: shooper
Donate link: https://shawnhooper.ca/
Tags: javascript, i18n, api
Requires at least: 4.4
Tested up to: 4.4.2
Stable tag: trunk
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
WP REST API enhancement to return JSON arrays containing localized strings registered with WordPress' wp_localize_script() function
WP REST API enhancement to return JSON arrays containing localized strings registered with WordPress' wp_localize_script() function
- Install & Activate Plugin
- Specify which localized scripts are allowed to be returned via the API using the allowed_restful_localized_scripts filter
- Go to endpoint
/wp-json/shawnhooper/v1/localized/
to see all scripts - Go to endpoint
/wp-json/shawnhooper/v1/localized/<script_handle>
to see a specific script.
By default, no scripts are allowed to be returned by the API.
To specify specific scripts that are allowed to be returned via the API:
add_filter('allowed_restful_localized_scripts', function($allowed) { array_push($allowed, 'my_script_name'); array_push($allowed, 'my_second_script_name'); return $allowed; });
To allow all scripts to be returned via the API:
add_filter('allowed_restful_localized_scripts', '__return_true');
- Update build tool dependencies to fix CVE-2022-1537, CVE-2022-0436 and CVE-2020-7729
- First release.