Hi Phillip
I’ve had a good go but unfortunately it’s not going to work.
Things work well until we set the mimetype, and because a regular post has no mime type it doesn’t work.
I’ve tried quite a few different options, but as soon as its set, the posts are excluded.
The only way I could think of, to do a search conditionally like that would be to use something like Advanced Custom Fields plugin.
You could add a custom field, to your media – https://www.advancedcustomfields.com/resources/adding-fields-media-attachments/
And mark all media you don’t want, with a checkbox to “exclude from search” or something similar.
Then you can use our post meta
tab (in the search form settings), to exclude the posts with this custom field… leaving the remaining combination of images + posts.
Its not ideal I’m sure, but it’s the best I could come up with.
Best