fbpx
Awesome

ACF Snippets

Handy snippets to help you use Advanced Custom Fields in your WordPress projects!

Store ACF pro license key in WordPress PHP configuration

It’s been a long awaited feature but as of version 5.11, the Advanced Custom Fields Pro license key can now be hard-coded using PHP into your WordPress configuration file. It’s simply a case of adding the following constant to your wp-config.php file or a config plugin of your own: See the offical release notes here: […]

Read more

How to update an ACF Google Map field programmatically using PHP

In my work on the ACF Custom Database Tables plugin, I write a lot of automated tests to ensure consistent handling as the plugin’s codebase evolves. A big part of this involves updating ACF fields using the update_field() function and then checking to make sure the data is stored in the database as expected and […]

Read more

Register a super simple toolbar for ACF’s WYSIWYG field

This snippet will allow you to register a custom toolbar configuration for your WYSIWYG fields. This is super handy when you need to give the user basic controls such as text colour and linking without all the added bits and pieces that come with the basic toolbar option.

Read more

Load ACF JSON files from multiple locations

ACF JSON is a great tool for version-controlling, deploying, and syncing ACF field groups across installations. Sometimes, however, having just the one acf-json dir can feel like a limitation. Fortunately, ACF allows us to register multiple load points which makes it possible to move ACF JSON files wherever they make the most sense. Register a […]

Read more

Split an ACF Flexible content field into Template Parts

If you’re like most WordPress Developers I know that use Advanced Custom Fields’ Flexible Content Field as a custom page builder, it’s likely you’ll be working with a large number of layouts. All of the logic could be contained in one file however I prefer to split each ‘row’ into its own partial for easy maintenance. […]

Read more

Hide the ACF Admin Menu Item on Selected Sites

If you’re using ACF-JSON to manage your field groups there’s typically no need to see the ACF menu item called ‘Custom Fields’ on your staging or production sites. It’s likely you’d need to keep the ACF ‘Custom Fields’ menu item visible for local development. You can use a variation of the snippet below to do exactly […]

Read more

Built by Hookturn

This site was created by Hookturn, the team behind ACF Theme Code Pro. If you are interested in contributing or have an extension to add, email us.

Sponsored by Pressidium

Awesome ACF is sponsored by the very awesome team at Pressidium. If you need reliable, secure and scalable Managed WordPress Hosting, check them out.

Stay up to date with all things ACF

TODO: Registration form here