WordPress Custom API GET request from External App with XML Parameter
WordPress Custom API GET request from External App with XML Parameter
WordPress Custom API GET request from External App with XML Parameter
How to use WordPress REST API to login a user with dart/flutter?
You’re using an invalid Content-Type header. x-www-form-urlencoded isn’t a valid content-type. The correct content type is application/x-www-form-urlencoded. Essentially, the web server doesn’t know how to handle the content type you’re giving it to parse the parameters. This is why the request is failing with a 400 because WP is not getting anything in the POST … Read more
My guess is, there is a filter causing change to the post content on api call. Could you check if the problem persists only in api or subscriber can see the content on normal page? The Restrict Content by Role plugin might be setting some rules that disallow subscriber role to view content in api … Read more
To pass the current post type to your AJAX request, you need to modify your JS to include the post type information in the AJAX request. You can achieve this by adding the post type as a parameter when calling the filterPosts() function JS import Alpine from ‘alpinejs’; Alpine.data(“filterPosts”, (adminURL, postType) => ({ posts: “”, … Read more
So I finally figured out my problems. One mistake I was making was not structuring $options properly. This is WRONG what i did: $options = array( ‘http’ => array( ‘header’ => “Authorization: Bearer $api_key\r\n”, ‘method’ => ‘GET’, ), ); I’m not supposed to use http. This is the CORRECT WAY to do it: $options = … Read more
I think I’ve figured out the solution. The short answer is GET requests don’t usually have a body, but wp_remote_get() will take what one assigns to the body argument and make it into URL parameters. That’s why it expects an array (because each element of the array becomes a parameter added to the URL). One … Read more
How to pass a file to an API call through WordPress
I ended up giving the wordpress api a go, and so far things are good. I found it easier to build an example post in the UI, retrieve the post using the API, and then use the retrieved fields to build a new post.
wp_remote_post to admin-ajax.php isn’t sending body value