WordPress REST API, Expired Nonce from Cache results in 403 forbidden

My wordpress site sits behind Akamai, which is a cacheing service similar to Cloudflare. I make the following API call: GET /wp-json/mytheme/v1/get-posts?post_type=videos This is done using apiFetch from ‘@wordpress/api-fetch’; And it automatically includes this in the request header X-WP-Nonce: 12323423 This works fine until 24 hours later, when the nonce expires. The cache still continues … Read more

Application passwords not working on localhost?

I have to get following error on the localhost “code”:”application_passwords_disabled” Server & Apache: Xampp v3.2.4 OP: Win 10 64Bit WP: v5.6.1 1 Answer 1 That error could happen if wp_is_application_passwords_available() returns a false, and the docs says: By default, Application Passwords is available to all sites using SSL or to local environments. Use ‘wp_is_application_passwords_available’ to … Read more

Custom Post Type and API REST is not working

I have created a custom post type called ‘customers’. I’m registering step by step as the documentation says. But when I make a call to the rest api, it just returns a 404 response. See the code below: add_action(‘init’, ‘customer_post_type’); function customer_post_type() { $labels = array( ‘name’ => _x(‘Customers’, ‘customers’), ‘singular_name’ => _x(‘Customer’, ‘customers’), ‘menu_name’ … Read more

Keep user’s privileges on accessing contents in JSON response

I use WordPress REST API plugin to fetch WordPress stuff on a mobile app. What Access manager plugin keeps the privileges on REST API responses? I want restrict access to certain posts, categories etc for a particular role, So when the user of that role authenticates via HTTP request, could not access to that post. … Read more

WP API ignores filter parameter

I’m trying to return a list of posts or media via the Rest API But it seems that when a filter incorrectly specified then a whole page of results is passed back. So a curl command like curl -gv “myamazingsite.co.uk/wp-json/wp/v2/media/?filter[id]=123” returns all media items, instead of a empty list. now curl -gv “myamazingsite.co.uk/wp-json/wp/v2/media/?filter[year]=2016” I get … Read more

WP REST API returns incorrect data?

I’m trying to get a page from the API based on its page template however it seems to be returning incorrect data? so I’m unsure whether I am using the API correctly. http://domain.dev/wp-json/wp/v2/pages?template=page-contact.php Returns pages using different page templates? Also if I was to query by page id, it brings back pages which are not … Read more