Support

Account

Home Forums Backend Issues (wp-admin) acf_render_field_setting() position in form Reply To: acf_render_field_setting() position in form

  • Yes, this is true. The generic acf/render_field_settings hook is only fired at the beginning. I know that the developer at least knows about this because I’ve brought it up on github, but I do not know the status of this. I’ve worked out my own solution. I would suggest opening a support ticket https://support.advancedcustomfields.com/new-ticket/

    I solve it by adding the action to every field type for now…. and this is also a little dependent on the version of ACF, 5.5.* stored the fields a bit differently. this is the relevant code from one of my plugins.

    
    $function = 'name of function to call';
    $priority = 1; // change to 20 for bottom of settings
    
    $acf_version = acf_get_setting('version');
    
    $sections = acf_get_field_types();
    
    if (version_compare($acf_version, '5.5.0', '<') || 
        version_compare($acf_version, '5.6.0', '>=')) {
      foreach ($sections as $section) {
        foreach ($section as $type => $label) {
          add_action('acf/render_field_settings/type='.$type, $function, $priority);
        }
      }
    } else {
      // >= 5.5.0 || < 5.6.0
      foreach ($sections as $type => $settings) {
        add_action('acf/render_field_settings/type='.$type, , $function, $priority);
      }
    }
    

    EDIT: You’ll want to do this on ‘acf/init’ or on ‘init’ with a high priority