Configuring the pluginCreating media items from unsafe URLs
Creating media items from unsafe URLs
By default, using the createMediaItem
mutation to create an image from an URL does not accept unsafe URLs, such as from a .local
domain (eg: https://testing-site.local/wp-content/uploads/2025/01/image.jpg
).
For instance, executing this query:
mutation {
createMediaItem(
input: {
from: { url: { source: "https://testing-site.local/wp-content/uploads/2025/01/image.jpg" } }
}
){
mediaItemID
status
errors {
__typename
...on GenericErrorPayload {
message
}
}
}
}
...might return:
{
"data": {
"createMediaItem": {
"mediaItemID": null,
"status": "FAILURE",
"errors": [
{
"__typename": "GenericErrorPayload",
"message": "A valid URL was not provided."
}
]
}
}
}
To override this behavior, go to the Settings page, under Schema Elements Configuration > Media Mutations and uncheck the Reject unsafe URLs option:
