Develop a plugin that utilizes the WordPress REST API to pull a list of most recently published posts from 3 to 5 other WordPress sites and display that list as a Dashboard widget in the WordPress admin. The list shall contain all posts/pages/custom post types and display 10 items by default; the user shall be able to change the number of items displayed. The user shall also have the ability to filter the list by website, the default list shall display all sites. A link/button to manually approve each post shall accompany each post in the list. When a user approves a post, the approval, username and a time stamp shall be passed to the site containing that page and each shall be stored in custom meta fields. Also, once approved, the post shall no longer appear in the list of recently published posts.
I thought it would be best to create the dashboard and corresponding Settings page right off the bat. After that, I decided to display recent posts from the website on which I was testing the plugin development. Once I got the titles, dates, and Approve/Deny buttons set up, I began hooking everything up. This was a little more difficult as I had a few hurdles to clear: displaying external posts by date, formatting returned data, and figuring out how to tweak my initial PHP code to make sure everything worked. I dug into the WP API docs and forums and managed to get the JSON objects returned in a readable format. My next challenge was to figure out the sorting, changing # of displayed items, and the approval/denial functionality. I researched the docs for operations on the Post type. I found the Status here (https://v2.wp-api.org/reference/posts/) and figured that was probably my best bet. What I'm submitting isn't pretty, since I ended up taking more time getting off the ground than I anticipated, but function over form, right?
I would have liked to dig into customizing the sites being pulled for JSON by adding those options into the plugin menu (Add/Delete Sites, etc) so that a non-developer could add and delete post feeds as they pleased, but unfortunately, I ran out of time. I will try to finish it on my own time because I think I'm on the right track in terms of making significant progress; however, I learned a great deal more than I was expecting about the WP REST API - I definitely thought I had a better understanding than I did, so I'm glad I 'failed' this challenge because it's igniting the drive to learn more and become a better dev.
I genuinely enjoyed digging into the nitty-gritty of figuring out how to hook everything up with the REST API and figure out the right parameters