• Hi,
    I am using wordpress media rest API to check for featued image. API is working fine and showing me most of the media details properly but for few media i am getting below error

    {

    "code": "rest_forbidden",

    "message": "Sorry, you are not allowed to do that.",

    "data": {

    "status": 401

    }

    }

    I am using administrator credentials to pull the record. also not sure why it is running for other media.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello @alankar1985,

    The error message "rest_forbidden" with status 401 indicates that the WordPress REST API is blocking access to certain media items due to permission issues. Here are some of tips that may help

    Go to the Media Library in the WordPress dashboard, check the visibility of the affected media items, and ensure they aren’t set to private or restricted.

    Verify that the current user role has the necessary capabilities to view the media items. Since you’re using administrator credentials, this shouldn’t usually be a problem, but some custom code or plugins could modify default capabilities.

    Thread Starter alankar1985

    (@alankar1985)

    Hi Pramodh,
    Thank you for your reply, Under media library i am not getting any option to see the viewing capabilities of media item like visibility.
    Please tell me where i can get it

    Hello @alankar1985,

    • Go to the Media Library.
    • Click on the media item in question.
    • Under “Uploaded to,” see if it is attached to a post, and check the status of that post (draft, published, private, etc.).

    If the media is attached to a draft or private post, try publishing the post to make the media item publicly accessible.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.