I couldn’t find this information in the documentation or in a search of the forums
I experienced a problem when creating a custom WP REST endpoint that serves up custom field data for map markers. I would get through the first part of the import, where it would verify the data structure and ask the map and which other information to import (markers etc), so I believe it knew the data was there and readable. However, I only got an error when actually performing the last stage of the import.
I saved the raw json data from the endpoint as a JSON file then uploaded this, it worked. So I knew the data integrity wasn’t an issue. After some trial and error, I discovered appending ‘.json’ to my custom endpoint URL resolved the issue e.g
Thank you very much for bringing this to our attention.
This is due to WordPress’ mime type security policies – It will refuse to open a directory or files with a .php extension. Your solution is ideal, I’d perhaps improve on that by changing the suffix to ?.json so that appears as a query variable rather than part of the route.