🥽 Beta testers needed! Stay up to date with the latest news from CTRLS.DEV

Hiding Advanced Custom Fields

Learn how to hide ACF field on the front- or back-end within your WordPress.

Today’s tip of the day is for the Advanced Custom Fields plugin.

In the 2 snippets below you, I show you how to hide an ACF field either on the front-end when using the acf_form() function or in the back-end and limit the field to edited and filled only by users that are administrators.

The Code

add_filter('acf/prepare_field/name=acf_field_slug', function ($field) {
  return false;
}, 10, 1);
add_filter('acf/prepare_field/name=acf_field_slug', function($field) {
  if(is_admin()) {
    return $field;
  return false;
}, 10, 1);

Subscribe to our Newsletter* if you find our content useful and would like to receive regular updates with the latest posts.

* We have a NO SPAM policy so you won't reaceive any meaningless emails from us!

Related Content

2 Methods to Quickly Add Any SVG to Gutenberg Editor

Learn how to add SVG icons to the Gutenberg editor.


5 Popular Web Page Components Done with Pure CSS

Open/close a modal window, create mobile navigation, build tab navigation, image gallery slider, and switch & button groups. All with pure CSS, no JS required.


How to Add Sub Domain on Kinsta

Step-by-step guide on how to add a subdomain to your Kinsta account.


Leave a Reply

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

5 Popular Web Page Components Done with Pure CSS
5 SASS Mixins for Your Next Project

Thank you for reading our content. Use the buttons below to spread the love and share How to Add Sub Domain on Kinsta with your followers.