Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Désactiver un champ ACF (lecture seule)
<?php
// Article/tutoriel complet sur https://mosaika.fr/astuces-developpement-acf/
// Documentation officielle https://www.advancedcustomfields.com/resources/acf-load_field/
/**
* Désactiver un champ (lecture seule)
* Filtre : acf/load_field
*/
function msk_acf_disable_field($field) {
$field['disabled'] = true;
//$field['readonly'] = true;
return $field;
}
add_filter('acf/load_field', 'msk_acf_disable_field');
//add_filter('acf/load_field/name=annonce_prix_avec_commission', 'msk_acf_disable_field');
//add_filter('acf/load_field/type=password', 'msk_acf_disable_field');
//add_filter('acf/load_field/key=field_5a9af8d5250dd', 'msk_acf_disable_field');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.