WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to create a Windows Store App using IdeaPress, which relies on the JSON API Plugin. Unfortunately requesting recent_posts returns just content up to the


tag. I'd like to display the whole post, though. Any ideas on how to do this?

This is my json code.

share|improve this question
up vote 2 down vote accepted

You can try this to show the full post content only in the JSON API:

function remove_more_wpse_96740($content) {
        global $post;
        $content = preg_replace('/<!--more(.*?)?-->/','',$post->post_content);
    return $content;
add_filter('the_content', 'remove_more_wpse_96740',1);

by targeting the json query variable and remove the <!--more--> part of the post.

If you have a custom string like <!--more But wait, there's more! -->, it will also be removed.

This part of the plugin in /json-api/models/post.php:

  function set_content_value() {
    global $json_api;
    if ($json_api->include_value('content')) {
      $content = get_the_content($json_api->query->read_more);
      $content = apply_filters('the_content', $content);
      $content = str_replace(']]>', ']]&gt;', $content);
      $this->content = $content;
    } else {

is fetching the content and the check for <!--more(.*?)?--> in the content takes place in the WordPress function get_the_content().

PS: Using the method above will disable <!--noteaser--> in the JSON API, but that should be alright since you want the full post content there.

share|improve this answer
get_query_var('json') should be changed to get_query_var('json_route'), as otherwise it won't work any more! – vlood Jan 18 '15 at 0:25
@vlood thanks for this new info. – birgire Jan 26 '15 at 14:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.