If you are developing a site for your client, where you are using ACF to add and show custom post meta content or any other content that ACF allows, it is sometimes (from my experience – almost all the time) better to hide the ACF from your clients or the people (generally less techy) who manages the site. This can save you a whole lot of headache, if somehow they delete/edit some content from ACF options.
If you are loading ACF options from PHP, you are already safe. But if you are not, then you should better think about hiding ACF.
acf/init
action hook can be used to hide ACF. But for some reason, this hook doesn’t always hide ACF! Instead I use init
hook and a piece of css code, to hide the settings icon from the options created by ACF.
function careless_no_acf_icon() {
echo '<style>.acf-postbox:hover > .hndle .acf-hndle-cog {display: none !important;}</style>';
}
add_action('admin_footer', 'careless_no_acf_icon');
function careless_custom_acf_init () {
acf_update_setting('show_admin', false);
acf_update_setting('capability', 'all');
}
add_action('init', 'careless_custom_acf_init', 1);
Code goes in the functions.php
file of your active theme.