Viewing 3 replies - 1 through 3 (of 3 total)
  • narolainfotech

    (@narolainfotech)

    Hello,
    you can try below API
    GET /wp-json/wp/v2/posts?status=publish,draft,trash
    set your domain name . like :
    example.com/wp-json/wp/v2/posts?status=publish,draft,trash

    Thread Starter sachinsingh2

    (@sachinsingh2)

    Hi @narolainfotech,

    https://localhost/wp-json/wp/v2/posts?status=publish,draft,trash

    It give me error as mention below

    {“code”:”rest_invalid_param”,”message”:”Invalid parameter(s): status”,”data”:{“status”:400,”params”:{“status”:”Status is forbidden.”},”details”:{“status”:{“code”:”rest_forbidden_status”,”message”:”Status is forbidden.”,”data”:{“status”:401}}}}}

    Regards

    Sachin

    Moderator bcworkz

    (@bcworkz)

    The API reference says we can only send one status value at a time. If true, you’d need to make separate requests for each desired status.

    I would have expected the ability to send an array of status values. Sending an array in a GET request is a little strange, we use empty square brackets for each array element. For example:
    example.com/wp-json/wp/v2/posts?status[]=publish&status[]=draft&status[]=trash
    I’m not too confident this would work, but no harm in trying it ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘wordpress REST API posts not showing other than Published’ is closed to new replies.