Search This Blog

Labels

adobe (1) android (3) apache (3) aviation (1) bash (2) chrome (2) composer (1) cookery (3) dev (2) dodanperks (1) extensions (1) facebook (2) firefox (1) git (2) grafana (1) guzzle (1) headaches (12) htaccess (1) html5 (2) jquery (2) lamp (1) life hacks (10) linux (29) mysqli (2) native (1) opera (2) php (10) railfanning (1) reactjs (3) reactnative (1) servers (11) sinhala (1) smartphones (2) snap (1) sound (1) tech (22) troubleshoots (5) ubuntu (30) unicode (4) virtualbox (1) wamp (2) web (11) windows (4) wordpress (3) youtube (2) කෑම (3)

Wednesday, 9 February 2022

How to filter posts by a certain post format including "standard" from wp-json api?

 

So I've been head scratching over this over a couple of days and finally got some light in the end of the tunnel. I wanted to share this in the public so another one of our breed won't have to go though the hell I went.

What I've done here is, querying for post types using WP_Query and then feed them to the standard WP REST API, so it would bring more data to the table; as I wanted. Enjoy!

You can use it as,
GET
/wp-json/unicorn/v1/blog-posts/standard/4
Note:
count
is optional.

No comments:

Post a Comment