2

I'm trying to get a page from the API based on its page template however it seems to be returning incorrect data? so I'm unsure whether I am using the API correctly.

http://domain.dev/wp-json/wp/v2/pages?template=page-contact.php

Returns pages using different page templates?

Also if I was to query by page id, it brings back pages which are not the id of 20?

http://autosmart.dev/wp-json/wp/v2/pages?id=20

Can anyone advise how to get the API to work correctly and whether I am querying the data correctly?

Thanks

4
  • how about http://autosmart.dev/wp-json/wp/v2/pages/20 , what you got?
    – Jevuska
    Jun 14, 2017 at 12:13
  • Yeah that worked :) Just that I need to get the page by the page template :/
    – lky
    Jun 14, 2017 at 14:03
  • in your case, It's about filtering github.com/WP-API/rest-filter, but from wp-json/wp/v2/pages you can search the object for specific template.
    – Jevuska
    Jun 14, 2017 at 14:57
  • Unfortunately, I was unable to download the plugin :( The package could not be installed. PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature
    – lky
    Jun 14, 2017 at 15:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.