BUG: Using 's' parameter in WP_Query and a single custom post_type as string instead of array, also searches for attachment post_type when Documents feature is active #3884
Goodmorning, I am testing EP and I am not 100% sure this is a bug, but the behaviour is very weird and I'd like to report it as a bug. Feel free to correct me and/or close it if I am wrong.
So I have activated the ElasticPress plugin on a development Wordpress site, and I have an archive template where I need to retrieve "events" based on a search form inside this template.
I am not using the default 's' parameter in the GET query string, but I am using the default 's' in the WP_Query args.
Describe the bug
Goodmorning, I am testing EP and I am not 100% sure this is a bug, but the behaviour is very weird and I'd like to report it as a bug. Feel free to correct me and/or close it if I am wrong.
So I have activated the ElasticPress plugin on a development Wordpress site, and I have an archive template where I need to retrieve "events" based on a search form inside this template.
I am not using the default 's' parameter in the GET query string, but I am using the default 's' in the WP_Query args.
If I print_r the Query like this, I can see:
If I disable the ElasticPress plugin OR if I disable the Documents feature OR if I set the post_type argument as array instead of string:
The result is different, the
attachment
post type is not present in the query vars anymore, as expected:As you can see,
[1] => attachment
is not there anymore.I do not expect to get attachments if I search for a single post_type as a string, it generates a weird behaviour in my opinion.
Let me know if you can reproduce the same behaviour as explained here. Thank you
Steps to Reproduce
attachment
inside the post_typeattachment
should be gone from the post_typeScreenshots, screen recording, code snippet
No response
Environment information
No response
WordPress and ElasticPress information
WP 6.4.3, EP 5.0.2
Code of Conduct