• json-api is a real well designed and very useful plugin and we evaluate its use for https://pixees.fr consisdering custom types (not yet on line), sounds really excellent.

    The «however» ?

    when applying on a custom-type we got a strange answer, e.g. http://localhost/wordpress/?quizz=test-de-json&json=1 response is

    <div style=’margin: 10px;’>[HERE COMES THE WHOLE UNESCAPED POST CONTENT]</div>{“status”:”ok”,”post”:{“id”:5183,”type”:”quizz”,”slug”:”test-de-json”,”url”:”http:\/\/localhost\/wordpress\/?quizz=test-de-json”,”status”:”publish”,”title”:”Test de question”,”title_plain”:”Test de question”,”content”:”\n”,”excerpt”:””,”date”:”2015-08-15 12:19:49″,”modified”:”2015-08-26 14:07:50″,”categories”:[],”tags”:[],”author”:{“id”:1,”slug”:”pixees”,”name”:”pixees”,”first_name”:””,”last_name”:””,”nickname”:”pixees”,”url”:””,”description”:””},”comments”:[],”attachments”:[],”comment_count”:0,”comment_status”:”closed”,”custom_fields”:{“quizz_json”:[“{\r\n \”choices\”: [\r\n \”Oui\”,\r\n \”Non\”,\r\n \”Ne sait pas\”\r\n ],\r\n \”multiple\”: false,\r\n \”text\”: 40,\r\n \”regex\”: \”\/(Oui|Non)\/\”\r\n}”], ../..}},”next_url”:”http:\/\/localhost\/wordpress\/?quizz=quoi”}

    In other word: it echoes the content 1st and then the (completely correct) JSON structure without the post content.

    Is this a (i) bad use on my side or a (ii) tiny bug or caveat ?

    I really guess it is (i) but i fail to figure out why (e.g., this may be related to a spurious definition of my custom type ?)

    https://ww.wp.xz.cn/plugins/json-api/

The topic ‘Using JSON-API with custom post type’ is closed to new replies.