Error /wp-json/wp/v2/posts/ [closed]
I reverted back to PHP 7.4 and that fixed the issue… now need to work with my developer on successfully upgrading to 8.0
I reverted back to PHP 7.4 and that fixed the issue… now need to work with my developer on successfully upgrading to 8.0
Fatal error in custom end point in WP-JSON
Use the JSON REST API – http://v2.wp-api.org – It lives as a plugin now but will eventually be part of WP Core – https://wordpress.org/plugins/rest-api/ To manually output JSON, use a combination of wp-ajax to handle requests and wp_json_encode() / wp_send_json_success for simple PHP Objects and Arrays. See https://codex.wordpress.org/AJAX_in_Plugins
It’s off-topic but if you just want to write the setup and punchline values to a text file you can do something like this: # Dependencies import json import requests # Specify the URL url = “https://official-joke-api.appspot.com/jokes/programming/ten” # Make request and store response r = requests.get(url) print(“Status code:”, r.status_code) jokes = json.loads(r.text) with open(“outfile.txt”, “w”) … Read more
Firstly, the custom posts need to have the ‘show_in_rest’ => true, parameter set on post registration – see Adding REST API Support For Custom Content Types for more detailed instructions. Secondly, I then usually navigate to yoursiteaddress.com/wp-json/ for example https://blog.ted.com/wp-json/ – there you’ll see a play-book for all the routes you can play with in … Read more
how build custom json api controller for all registered users
This is a WordPress setting you can change. Login to the WP admin panel, click Settings > Reading, change “Syndication feed show the most recent” from the default 10 items to something higher, and click Save. If you don’t see the change immediately, try clearing the recent cache in your browser, or open the link … Read more
Output JSON and no theme
There are a number of action hooks for Post Status Transitions. They each receive the $post object as an argument. You could use these to trigger a function that writes your file to disk using fopen. Edit: if you’re writing CSV, PHP has a function specifically for that: fputcsv (fopen still required)
Remove the filter wptexturize, which is what’s causing your encoding issue: remove_filter( ‘the_title’, ‘wptexturize’ ); while ( $loop->have_posts() ) { // Your code }