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

Get access to all 525 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
How to Move an Element into Another on Smaller Viewports in Bricks

How to Move an Element into Another on Smaller Viewports in Bricks

This Pro tutorial provides the steps to move a Block containing a Heading and WP Grid Builder's Facet into BricksExtras' OffCanvas element for viewports 991px…
Pro
Stock Quantity Block for WP Grid Builder

Stock Quantity Block for WP Grid Builder

In the unofficial WP Grid Builder Facebook group a user asked: Is it possible to show stock quantity on the card? I can't find it…
Categories:
Pro
WP Grid Builder Filters inside Bricks’ OffCanvas

WP Grid Builder Filters inside Bricks’ OffCanvas

This Pro tutorial provides the steps to move WP Grid Builder's filters inside the Bricks' native Offcanvas on smaller viewport widths. Let's work with the…