Title: Defining post_status or post_type
Author: WordPress VIP Documentation
Published: November 15, 2023
Last modified: December 29, 2025

---

 1. [Databases](https://docs.wpvip.com/databases/)
 2. [Optimize database queries](https://docs.wpvip.com/databases/optimize-queries/)
 3. Defining post_status or post_type

#  Defining post_status or post_type

By default, the `post_status` of a query is set to `publish` for anonymous users
on the front end. It is not set in any WP_ADMIN context, including Ajax queries.

Queries on the front end for logged-in users will also contain an OR statement for
private posts created by the logged-in user, even if that user is not part of the
site. This will reduce the effectiveness of MySQL indexes, specifically the `type_status_date`
index.

The same is true for `post_type`. If it is known that only a certain `post_type`
will match the rest of the query (for example, for a taxonomy, meta, or just a general
query), adding the `post_type` as well as the `post_status` will help MySQL better
utilize the indexes at its disposal.

Last updated: December 29, 2025