Home Forums Backend Issues (wp-admin) Disabled JS input (Select, User, …) Save as empty Reply To: Disabled JS input (Select, User, …) Save as empty

  • I found a solution by myself. Some input type as Chekbox type have an additional hidden input so I need to disabled all the input used by ACF.

    Exemple for Chekbox :

    add_filter('acf/prepare_field', 'edit_prepare_field');
    function edit_prepare_field( $field ) {
    	case 'checkbox':
    		$field['wrapper'] = array('width'=> $width,'class'=> 'disabled_checkbox');
    		$field['readonly'] = 1;
    	return $field;
    function read_only_field_javascript() {
    	$('.disabled_checkbox select').prop('disabled','disabled');
            $('.disabled_checkbox input').prop('disabled','disabled');

    User field is more complex (use <span> for exemple) and can’t be disabled by the previous methode, some other like gallery can really be disabled so I change the field type to “enhanced_message” and display the value with some PhP.