13th Feb '24
/
1 comment

Programmatically populating ACF field values in WordPress

ACF has a handy acf/load_field filter for programmatically filling the choices of field types like 'Select' that have multiple values.

This Pro tutorial provides an example of how to set the values of a Select-type field with the names and labels of all public post types in the site.

Notices how Choices are empty.

Now let's use the acf/load_field filter to automatically populate the choices with public post types minus attachments and Bricks templates.

Result after implementing the tutorial:

Step 1

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Get access to all 611 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
Frontend Editing with ACF in Bricks

Frontend Editing with ACF in Bricks

This Pro tutorial provides the steps to show a form on single posts on the front end for admins and the post author using which…
Categories:
Pro
Filtering a Bricks Terms query on Term archive pages

Filtering a Bricks Terms query on Term archive pages

On product category archives, how to show product type names but only those that the current product category has.
Pro
Conditionally Excluding Elements from Bricks Editor

Conditionally Excluding Elements from Bricks Editor

In the past, we shared How to Exclude Elements from Bricks Editor. This Pro tutorial shows how specific elements can be excluded selectively based on…
Pro
Setting a Bricks template for Parent pages

Setting a Bricks template for Parent pages

This Pro tutorial shows how bricks/active_templates filter can be used to programmatically assign a Bricks template to all singular pages (of any post type) that…