Created
March 21, 2019 15:05
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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