WordPress.org

Ready to get started?Download WordPress

Forums

JSON API
any plans to handle post_status (2 posts)

  1. TomekR
    Member
    Posted 1 month ago #

    Hi,
    According to the documentation, this fantastic plug-in ignores nowadays the post_status parameter.
    Any plans for adding this? Or is there any workaround?
    In my case I need to download posts which are planned to be published (future value of post_status, I suppose).
    Any help will be appreciated.

    https://wordpress.org/plugins/json-api/

  2. TomekR
    Member
    Posted 1 month ago #

    For all others interested:
    I've achieved it by modifying introspector class, set_posts_query function, where I've just added this line:

    $query['post_status'] = array( 'publish', 'future' );
    before last if.

    This is quite primitive way and probably will not work well in case of other post_status values (authorization consideration if status is draft) but works fine for planned posts.

    btw
    I don't know php and maybe that's why I don't understand, how it works, that in the mentioned function there are lines of sort:
    some_var = $json_api->query->post_type
    i.e. post_type field is referenced, but I couldn't find any definition/declaration of post_type field in query object, which is JSON_API_Query type, as far I understand.

Reply

You must log in to post.

About this Plugin

About this Topic