0

I have two bidirectional fields 'album_band' in two different custom post types 'album' and 'band'.

This field allow multiple selection and is mandatory in 'album'

I've been trying to disable or set it as 'read only' this field in one custom type 'band' (backend side) to avoid empty value in 'album' but without success.

  • Are you using a plugin to create the fields or are you using the built in custom fields system? – James Jan 9 at 23:24
  • yes i used ACF which doesn't provide any option in that direction – Xavier Jan 9 at 23:46
  • What do you mean 'bidirectional', 'multiple selection' and 'mandatory'? Is it search? Filter? Show us your code! – Max Yudin Jan 10 at 9:15
1

Looks like I've found a way. i've managed to find the field name in mysql :

function acf_read_only( $field ) { $field['readonly'] = 1; $field['disabled'] = true; return $field; }

add_filter('acf/load_field/key=field_5e144c7878e7f', 'acf_read_only');

SOLVED !

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.