Skip to content

Instantly share code, notes, and snippets.

@MaximeCulea
Created July 24, 2019 08:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MaximeCulea/86b0834a2768a01706e56d7fd1391806 to your computer and use it in GitHub Desktop.
Save MaximeCulea/86b0834a2768a01706e56d7fd1391806 to your computer and use it in GitHub Desktop.
Customize ACF fields and options.
<?php
/**
* Hide ACF Edition buttons for repeater for publication_most_commented, etc
*/
function admin_print_scripts() {
echo "<script type='text/javascript'>jQuery(\"[data-name='publication_most_commented'], [data-name='publication_by_user'], [data-name='publication_most_liked']\").find('.acf-actions, .acf-row-handle').hide();</script>";
}
add_action( 'admin_print_footer_scripts', 'admin_print_scripts' );
/**
* Disable fields for edition
*
* @param array $field
*
* @return array
*/
function disable_field( $field ) {
$field['disabled'] = 1;
return $field;
}
add_filter( 'acf/load_field/name=group_most_active', 'disable_field' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment