« Back to Glossary Index

A query, in a database context, is a specific request for information sent to a database, asking it to retrieve, insert, update, or delete data. In WordPress, queries are how the platform actually fetches posts, pages, and other content from its MySQL database.

A query like `SELECT * FROM wp_posts WHERE post_status = 'publish'` asks the database to retrieve every post currently marked as published — a small, direct illustration of the general pattern SQL queries follow throughout.

  • The Loop — WordPress's core mechanism for retrieving and displaying posts, relies on an underlying database query
  • WP_Query — a flexible PHP class letting developers build genuinely custom queries
  • Custom queries — used to power specialized displays, like a specific category of related posts

"Query" is also commonly used in an SEO context to mean a search query — the actual words someone types into a search engine. Google Search Console reports directly on which specific queries are driving traffic to a site, which is a genuinely different, though related, usage of the same term.

« Back to Index
Share This