Last active
June 15, 2020 23:32
-
-
Save utkrishta/0b7896d24caae97ef3805ac6466949c5 to your computer and use it in GitHub Desktop.
Hide Given ACF fields on custom post type
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 given ACF fields on "my_cpt" post_type | |
function my_custom_function() { | |
global $current_screen; | |
if ( 'my_cpt' == $current_screen->post_type ) { | |
?> | |
<script> | |
(function () { | |
var x = document.querySelectorAll("a[data-key='field_5ea76a5ac9b48']"); | |
//change data-key as required | |
var i; | |
for (i = 0; i < x.length; i++) { | |
x[i].style.display = "none"; | |
} | |
})(); | |
</script> | |
<?php | |
} else { | |
//echo 'not my_cpt'; | |
} | |
} | |
add_action( 'admin_head', 'my_custom_function' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment