Build reusable database query presets
A database query preset is a named content selection that POM Theme modules can reuse. It keeps the post types, limits, status, authors, ordering, and taxonomy filters together so the same selection does not need to be rebuilt in every component.
Create presets after representative content and taxonomy terms exist. This makes it possible to verify the actual result before connecting it to a public listing.
Create the preset
- Open Settings → POM Theme → Content model → Database queries.
- In Database queries, choose Add query.
- Enter a descriptive Query name based on the result, such as “Published instructors by menu order”.
- Select the Enabled post types that may contribute entries.
- Set Posts per page and, only when required, Offset.
- Choose the allowed Post status values.
- Restrict the result to specific Authors when authorship is part of the requirement.
- Choose Order by and Order.
- Select included terms in each available Taxonomy taxonomies field.
- Select exclusions in Exclude Taxonomy taxonomies when needed.
- Use Relation to choose whether multiple taxonomy clauses use AND or OR.
- If Polylang Pro is active, choose the required Language behavior.
- Save the settings.
Public visitor lists should normally use published content. Other statuses can reveal entries that are not intended for general publication when the preset is used on the front end.
Understand limits and ordering
Posts per page caps the number of returned entries. Offset skips entries at the start of the ordered result, so changing the sort order also changes which entries are skipped.
Available Order by choices are:
- Date
- Author
- Title
- Modified date
- Random
- Menu order
Use Random only when the changing order is intentional. Use Menu order when editors need explicit control and the selected post types support page-order attributes.
Combine taxonomy filters
Included terms use positive matching; excluded terms remove matching entries. Relation controls how the taxonomy clauses work together:
- AND requires every included or excluded clause to pass.
- OR allows any clause to match.
Start with one taxonomy filter, confirm the result, and then add the next. A preset with no results is often valid but over-constrained.
Connect and verify the preset
Saved queries can provide content to supported POM Theme features such as listings, feeds, carousels, A–Z results, map results, related content, search suggestions, and Faceted Search.
When connecting a preset:
- Select it in the consuming component.
- Compare the displayed count and order with the saved settings.
- Test an entry that should be included and one that should be excluded.
- Test the empty result.
- Publish a new matching entry and confirm it joins the result in the expected position.
If the wrong post types appear, review Enabled post types first. If no entries appear, temporarily remove taxonomy exclusions and author restrictions, then restore one constraint at a time.
For the underlying relationships, see Connect post types and taxonomies.