WordPress.org

Ready to get started?Download WordPress

Forums

JSON API
Replace "post" in queries with different word (1 post)

  1. seaneherron
    Member
    Posted 2 years ago #

    Hi all,

    I'm trying to basically replace the word post in all of the queries in the core controller with another word. For example, instead of:

    http://www.example.org/?json=get_recent_posts

    I'd like to have

    http://www.example.org/?json=get_recent_items

    or

    http://www.example.org/?json=get_item

    etc.

    I tried duplicating the core controller and simply changing the function names, but that doesn't seem to give me any luck. It looks like they all reference each other, which is causing the issue. When I try and go through and replace things like $post with $item, it also fails out. I can't seem to find a clear delineation between what the plugin is referring to as a post and when it is going to wp_query(). Can anyone assist with this?

    Also - is there a simple way to just remove a specific item from the JSON response? For instance, if I wanted to remove the author information from the response, would editing models/post.php to remove the following do the trick, or is there something else I should be aware of?

    function set_author_value($author_id) {
        global $json_api;
        if ($json_api->include_value('author')) {
          $this->author = new JSON_API_Author($author_id);
        } else {
          unset($this->author);
        }
      }

    Many, many thanks!

    http://wordpress.org/extend/plugins/json-api/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags