Hiding Advanced Custom Fields in the Admin

This is going to be a quick tip today. There are times when you may want to use an Advanced Custom Field for development but don’t want it to clutter the admin interface. One scenario that I have run into, which I plan on blogging about in the future, is adding a unique ID to rows of a repeater. In this way, you can easily target a row’s CSS or target the row in JavaScript.

When you edit a field in Advanced Custom Field, one of the sections is the “Wrapper Attributes.”

One of the options in this section is for a CSS class. Advanced Custom Fields provides a CSS class in the acf-global.css file, acf-hidden. This class is very simple and adds a display: none to the field in the admin. Simply add acf-hidden as a class on your field and it will no longer take up space in the admin interface.


Leave a Reply to Mack Cancel reply

Your email address will not be published. Required fields are marked *