Last active
October 13, 2024 06:06
-
-
Save emre-edu-tech/1b2d1dadad9664ff06b513a5ad6d47b3 to your computer and use it in GitHub Desktop.
Making an ACF field readonly to prevent the users to enter a value.
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 | |
// Make Custom Field Readonly | |
function make_price_field_readonly($field) { | |
$field['readonly'] = true; | |
return $field; | |
} | |
// price_field_name is the slug of the Custom Field | |
add_filter('acf/prepare_field/name=price_field_name', 'make_price_field_readonly'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment