Easy get page, post and custom post inforamtion for frontend develop!
This plug-in was developed for the purpose of improving the efficiency of component sorting by page type in SPA development on the frontend. When this plugin is enabled, the page status is returned using the URI as a key.
post_type | endpoint | notes |
---|---|---|
page(default) | /wp-json/wp/v2/page-info/{URI} | |
post(default) | /wp-json/wp/v2/page-info/post/{URI} | needs post |
archive(default) | /wp-json/wp/v2/page-info/post | needs post |
custom_post | /wp-json/wp/v2/page-info/{URI} | |
arthive(custom_post) | /wp-json/wp/v2/page-info/{URI} |
- Attention!!!
Page and Custom post use only {URI}, but default post(archive) needspost
.
{
"current": "post/hello-world",
"the_id": 4,
"is_home": false,
"is_page": false,
"is_single": true,
"is_archive": true,
"is_404": false,
"preview_revision_id": "",
"meta": [ ]
}
If you customize response data(ex: breadcrumbs, meta desciption, etc...), please hook to apply_filters('filter_rest_pageinfo_for_wp', $info, $request)
.
If you want get preview post, need jwt plugin for check wp logined.
$ docker-compose up -d
$ docker exec -it wprestpageinfo_db bash -c "mysql -h localhost -u exampleuser -pexamplepass exampledb < /sql/sample.sql"
Sampel post
http://127.0.0.1:8080/wp-json/wp/v2/page-info/post/hello-world
http://127.0.0.1:8080/wp-admin
User name | Password |
---|---|
admin | admin |
= 1.0.0 =
- Publish plugin!
= 1.0.0 =
- Publish plugin!