Support » Plugin: JSON API » Querying multiple custom post types

  • note: This is more of a suggestion (or request for confirmation that I’m not doing something insane) than an issue.

    I wanted to be able to query multiple custom post types, and couldn’t see an easy way to do that. What I’ve done to solve this is edit the check on post_type in set_posts_query (singletons/introspector.php) to take a comma-separated array (e.g. a querystring parameter like post_type=hangers,cups,toys).

    if ($json_api->query->post_type) {
        $query['post_type'] = explode(',',$json_api->query->post_type);

    Is this sane? Is there a way to do it without hacking introspector.php? I don’t generally like modifying plugin code because it’s a maintenance headache.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Querying multiple custom post types’ is closed to new replies.