Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The condition for building the post_status parameter in a simple query #1800

Closed
vnmedeiros opened this issue Jun 11, 2020 · 5 comments
Closed

Comments

@vnmedeiros
Copy link

Hey guys!
I have a doubt, on post_status parameter of the WP_Query class the default value is‘ publish ‘, but if the user is logged in,‘ private ‘is added, see:
https://developer.wordpress.org/reference/classes/wp_query/#status-parameters

but the elasticpress when on perform query only adds the private status if the request is made through an administrative page and if the user is logged in, see here:
https://github.com/10up/ElasticPress/blob/master/includes/classes/Indexable/Post/Post.php#L1232

any special reason for having this difference?
Thanks!!

@vnmedeiros vnmedeiros added the type:question Further information is requested. label Jun 11, 2020
@oscarssanchez
Copy link
Contributor

oscarssanchez commented Jun 21, 2020

Hey @vnmedeiros ,

I think you are right! I did a search with and without elasticpress.

Without, I get some results when looking for a private post. With EP enabled, I get no results.

I'll craft a PR for this.

@oscarssanchez
Copy link
Contributor

Hi @vnmedeiros ,

I made #1813 to address this. Could you give it a try see if it solves the issue for you?

@vnmedeiros
Copy link
Author

Hi @oscarssanchez
cool!
I'll test, thank very much!

@oscarssanchez
Copy link
Contributor

@brandwaffle even with protected content enabled the query that's being run with ElasticPress does not return results. As we are returning them in the admin, I think we should include them if protected content is enabled and you are logged in as an admin or you have the correct capability

@oscarssanchez
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants