rAthus

[WP] ACF option lecture seule (readonly)

Mar 8th, 2022 (edited)
654
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. /********************************************\
  2. |* option lecture seule (readonly) pour ACF *|
  3. |* (uniquement pour types text et textarea) *|
  4. \********************************************/
  5.  
  6. function add_readonly_and_disabled_to_fields($field) {
  7.     acf_render_field_setting($field, array(
  8.         'label' => __("Read Only?",'acf'),
  9.         'instructions' => '',
  10.         'type' => 'radio',
  11.         'name' => 'readonly',
  12.         'choices' => array(
  13.             0 => __("No",'acf'),
  14.             1 => __("Yes",'acf'),
  15.         ),
  16.         'layout' => 'horizontal',
  17.     ));
  18. }
  19. add_action('acf/render_field_settings', 'add_readonly_and_disabled_to_fields');
Add Comment
Please, Sign In to add comment