Hide the ACF Menu on Production Sites
Removes the Advanced Custom Fields menu on the live site so field groups can only be edited on development or staging, where changes are synced through JSON.
Opens WPIDE on
Code
add_filter( 'acf/settings/show_admin', function ( $show ) {
return 'production' === wp_get_environment_type() ? false : $show;
} );
Notes
Set WP_ENVIRONMENT_TYPE to "staging" or "development" on other copies of the site. Fields keep working on production.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.