Skip to content

Instantly share code, notes, and snippets.

@dnshulga
Created March 21, 2019 15:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dnshulga/248d1056900dc57b9d43b6693d41dcb8 to your computer and use it in GitHub Desktop.
Save dnshulga/248d1056900dc57b9d43b6693d41dcb8 to your computer and use it in GitHub Desktop.
Hide ACF totally: remove admin menu page, remove gear of ACF from pages, do redirect from ACF admin menu page
<?php
/*Hide ACF Tottally*/
add_filter('acf/settings/show_admin', '__return_false');
function pands_admin_colors() {
echo '<style type="text/css">
h2.hndle.ui-sortable-handle a.acf-hndle-cog { display: none; visibility: hidden }
</style>';
}
add_action('acf/input/admin_head', 'pands_admin_colors');
function disallowed_acf_page() {
global $pagenow;
if ($pagenow == 'edit.php' && isset($_GET['post_type']) && $_GET['post_type'] == 'acf-field-group') {
wp_redirect(admin_url(), 301);
exit;
}
$type = get_post_type($_GET['post']);
if ($type == 'acf-field-group') {
wp_redirect(admin_url(), 301);
exit;
}
}
add_action( 'admin_init', 'disallowed_acf_page' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment