Setting pages for posts

Solutions is to add a $page entering value to the function and in the curl route that represents the page number to end up with a route like this curl -i websitename/wp-json/posts/page_number where $page is page_number public function posts($page){ $args = array( ‘author’ => $id, ‘posts_per_page’ => 24, ‘offset’ => 0, ‘meta_key’ => $meta_key, ‘orderby’ … Read more

Get JSON from self hosted wordpress site

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

Create a file format (csv,json,etc) when save/update a Post

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)

Result from wp_send_json adds line feed

Well that was tricky. This was the offending code that was generated a line feed to the response. add_action(‘wp_ajax_nopriv_display_event_info’, ‘DisplayEventInfoBox’); ?> <?php function displayStepHeader($isValid, $pos) I changed it to add_action(‘wp_ajax_nopriv_display_event_info’, ‘DisplayEventInfoBox’); function displayStepHeader($isValid, $pos) and all is well. I have no idea why that was an issue but how I tracked it down may be … Read more