Home › Forums › ACF PRO › Populate repeater in CPT from repeater in Options page › Reply To: Populate repeater in CPT from repeater in Options page
you can disable the disable editing of some fields by making them read only using and acf/load_value filter. When dealing with repeater sub fields you should always use the field key.
add_filter('acf/load_field/key=field_56e870552a8c1', 'make_field_readonly');
function make_field_readonly($field) {
// do not do this if it's the options page
// if you're using the same field group
global $post;
if ((!$post) || !isset($post->ID) || get_post_type($post->ID) != 'your-post-type') {
return $field;
}
$field['readonly'] = 1;
return $field;
}
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.