How to Limit a WP Grid Builder’s Term Grid to Only Current Post Terms

In the WP Grid Builder Facebook group (unofficial), a user asks:

Hi All, I'm looking for a way to update the contents of a grid that is set to 'Content Type > Terms' and is being used on a single post template, to only show the terms the currently being viewed post has. Any suggestions?

This Pro tutorial shows how wp_grid_builder/grid/query_args filter can be used to limit the terms of a WP Grid Builder terms grid to only the terms of the current post when viewing any single post.

Let's say your "Categories Grid" is set up like this:

When this grid's shortcode is inserted in the single post template, *all* the terms in the site will be output.

To limit the terms to only the current post terms, add the following in child theme's functions.php or a code snippets plugin:

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Instant access to 390+ Bricks code tutorials with BricksLabs Pro