Support » Plugin: JSON API » [Plugin: JSON API] Other plugins output before json content

  • Hi,

    We are developing the Just Map It! plugin for WordPress which uses this plugin to get data about posts and tags remotely.

    A few users reported that the service was not working as expected and that the data exposed by the json services was not valid.

    After some investigations we found that some plugins are not very carefull of how they output information and they are always printing javascript or html elements without checks.

    These elements are also printed before the json markup returned by this plugin.

    Would it be possible to clean all information printed on the page before outputting the json content and thus get rid of these issues ?
    (using ob_clean for exemple ?)


Viewing 1 replies (of 1 total)
  • Hi,

    No news on this issue ?
    I’m pretty sure other users experience this behaviour.
    The multisite robotstxt manager plugin for wordpress tries to clean the page before outputting the robot.txt content using output buffering.
    Taking this as a sample, here is a patch for the response.php singleton.

    --- response.php	2012-07-19 10:34:57.000000000 +0200
    +++	2012-07-19 10:34:12.000000000 +0200
    @@ -91,9 +91,7 @@
           header('HTTP/1.1 200 OK', true);
           header("Content-Type: application/json; charset=$charset", true);
    -    ob_start(); /* why not? */
         echo $result;
    -    ob_end_flush();
       function callback($callback, $result) {

    Please make some feedback here if it worked successfully for you.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: JSON API] Other plugins output before json content’ is closed to new replies.