Site icon Hip-Hop Website Design and Development

Guide to the new Query Loop Block

Guide to the new Query Loop Block →

I was talking with the current students in the Up and Running Bootcamp last week about the new Query Block in WordPress 5.8. I had to admit I’d not really played with it much myself. For that reason, I was quite excited that when I sat down to look for posts to share this morning with you all, I found this great little guide to it that Justin Tadlock put together over on the WP Tavern a few weeks ago.

For those who aren’t yet comfortable with the name of this block, here’s Justin’s great summary:

The term “Query” is simpler than you might think. It merely means to “query” or “ask” for posts from the database according to a defined set of options. For example, one might attempt to get the last 10 blog posts.

“Loop” is an even easier concept to grasp. It means to “loop” or “cycle” through each queried post and output it. Technically, a developer could do things other than displaying the posts during this process, but we are only concerned with what gets printed on the screen.

The two things combined become the Query Loop block. It allows users to ask for a set of posts and display each one.