The Query Loop block allows you to query and display WordPress posts, pages, or custom post types in your email templates. Use it to create dynamic content like blog post summaries, recent posts, or custom post type listings.
Adding a Query Loop Block
- While editing your email template, click theย “+”ย button to add a new block
- Search forย “Query Loop”ย or find it in theย “Theme”ย category
- Click to insert the block
- Add a Post Template block inside to define how posts are displayed
Query Settings
Post Type
Select which post type to query:
- Posts: WordPress blog posts
- Pages: WordPress pages
- Custom Post Types: Any registered custom post types
Number of Posts
- Posts Per Page: Set how many posts to display
- Offset: Skip a number of posts before starting
Order
- Order By: Sort posts by date, title, author, etc.
- Order: Ascending or descending order
Filters
- Author: Filter by specific author
- Search: Filter by search term
- Categories/Tags: Filter by taxonomy terms
- Exclude: Exclude specific posts
- Sticky Posts: Include or exclude sticky posts
Adding Post Templates
- Click inside the Query Loop block
- Add aย Post Templateย block
- Inside the Post Template, add post information blocks:
- Post Title
- Post Date
- Post Excerpt
- Post Featured Image
- Other custom blocks
Post Template Structure
A typical Post Template includes:
- Post Titleย – Title of the post (often as a heading)
- Post Dateย – Publication date
- Post Excerptย – Summary or excerpt
- Post Featured Imageย – Featured image (optional)
- Link to Postย – Make titles or content clickable
Best Practices
- Relevant Content: Query posts that are relevant to your email recipients
- Limit Results: Don’t display too many posts (3-5 is usually sufficient)
- Clear Layout: Design Post Templates for easy scanning
- Recent Content: Often useful to show recent posts
- Link to Full Content: Include links to full posts
Examples
Example 1: Recent Blog Posts
Query Settings:
- Post Type: Posts
- Posts Per Page: 3
- Order By: Date
- Order: Descending
Template: Title + Date + Excerpt + “Read More” link
Example 2: Featured Pages
Query Settings:
- Post Type: Pages
- Posts Per Page: 5
- Filter by: Specific category or tag
Template: Title + Featured Image + Excerpt
Troubleshooting
Posts Not Displaying
- Verify posts exist that match your query criteria
- Check that the Post Template block is added inside Query Loop
- Ensure post types are properly registered
- Verify query parameters are correct
Wrong Posts Showing
- Review query settings (post type, filters, order)
- Check that filters are correctly configured
- Verify post status (published posts only)
Template Not Rendering
- Ensure Post Template block is properly nested inside Query Loop
- Check that post blocks are inside the Post Template
- Verify posts match query criteria
Additional resources
Use the links below for more information and guidance on adding blocks. Keep in mind that these articles are general information related to the WordPress Editor and building with blocks. Email Customizer does not utilize all blocks or functionality due to the limited capabilities of emails.
WordPress Editor