Home › Forums › Backend Issues (wp-admin) › Change value of read-only field
I add to my function.php file some code to be able to choose wich wordpress role can see, or edit each field in the several custom posts I added.(acf_render_field_setting for adding the two new fields in the ACF management and the prepare_field filter to set the read-only param’)
Cause of several field type, like the datepicker, can’t be read-only, I first change the field type to ‘text’, but it’s clearly not userfriendly at all.
Do you have a solution (function or a filter) that’s allow me to change the displaying value but which not change the saved value ? (for the datepicker, value in database is still “yyyymmdd” but field are read-only and display “dd/mm/yyyy” ?
I can add “clone” for each field with enhanced message or others but I first want to know if there are a proper way to do …
Here’s some code that I used in a recent project to do that, which demonstrates how to Disable various field types (Date Picker, Button Group/Radio Buttons, Select, Textarea, Repeater, WP Title)…
At any rate, the above should get you going if you want to disable fields other than just the Basic fields.
Hum sounds like a solution =D. And I just asking myself what to do with the add and remove button of repeater fields … Perfect !
I’ll try …
To confirm : it works perfectly ! Thanks !
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
Are you building WordPress sites with ACF and @BeaverBuilder, and wanted to use your ACF Blocks in both the block editor and Beaver Builder?— Advanced Custom Fields (@wp_acf) May 10, 2023
The BB team recently added support for using ACF Blocks in Beaver Builder. Check it out 👇https://t.co/UalEIa5aQi
© 2023 Advanced Custom Fields.