12% off of LTD using this coupon: TWELVEPERCENTOFF. Promo ends on 2 Dec midnight UTC.
Published on Feb 10, 2022

How to check if the specified field is not empty for the current taxonomy term when using Meta Box

Sridhar Katakam

This members-only tutorial provides the steps to register a custom function that takes a Meta Box field ID as the argument and returns true or false depending on whether that field has a value when viewing a taxonomy term archive.

Sample use case: This can be used to conditionally output a Section on category archive pages only when the Image Advanced-type of field attached to categories has at least one image set for the current category being viewed.

Step 1

Install and activate Code Snippets plugin.

Go to Snippets > Add New.

Title: [Function] Check if the specified field is populated for the current taxonomy term

Code:

This is a premium members-only content.

To view the rest of the content, please sign up for membership ($47/month or $599 one-time).

Already a member? Log in below or here.

tagschevron-leftchevron-rightchainangle-rightangle-upangle-downfolder-omagnifiercrossmenuchevron-downarrow-right