Home Forums Feature Requests Group Options (acf_render_field_wrap) is there an officiel way to do this?


Group Options (acf_render_field_wrap) is there an officiel way to do this?

  • Hi,
    I’m using ACF Pro 5 latest.

    My field group needs a custom option (for the whole group, not for its fields), like this:

    Group Option

    So I played around the code and found I only had to had a new group to wp-content/plugins/advanced-custom-fields-pro/admin/views/field-group-options.php and add the default value into wp-content/plugins/advanced-custom-fields-pro/api/api-field-group.php:

    // grid width
    	'label'			=> __('Largeur du groupe','acf'),
    	'instructions'	=> __('Largeur du template comportant cette grille de contenus','acf'),
    	'type'			=> 'number',
    	'name'			=> 'grid_width',
    	'prefix'		=> 'acf_field_group',
    	'append'		=> 'px',
    	'value'			=> $field_group['grid_width'],
    ), 'tr');


    function acf_get_valid_field_group( $field_group = false ) {
    	// parse in defaults
    	$field_group = acf_parse_args( $field_group, array(
    		'ID'					=> 0,
    		// (...)
    		'hide_on_screen'		=> array(),
    		'grid_width'			=> 590,
    // (...)

    Of course since I am editing ACF’s core files, my custom group options will go away at the next upgrade of the plugin.

    So, is there an official way to do this?

    I couldn’t find any reference to acf_render_field_wrap().

    Thanks for reading!
    Cookies for answering 🙂

  • Hey,

    did you find a solution for it? I have the same issue.


  • Hi @endcore, unfortunately I got no reply from the Support so I ended up with disabling auto-update of the plugin (by removing the key used for the pro version) and copy/pasting my custom edits each time a new version is out.

    Obviously this is not a professional way to maintain a site, so I hope this featured will be official soon.

    Don’t forget to reply to this topic if you find a way!

  • Hi guys

    Thanks for the topic and ideas.

    I’ve just added in a new action (to the next version not yet released 5.2.6):

    You will be able to use it like this:

    add_action('acf/render_field_group_settings', 'my_function', 10, 1);
    function my_function( $field_group ) {
  • Why don’t you add this action to the documentation? Hard to find it with the google search.

  • I can’t get this to work. Using it like so in my functions.php file. When I add a print_r($field_group) It appears below the field settings. So I guess it’s being called too late to be taken into account.

    add_action('acf/render_field_group_settings', 'my_function', 10, 1);
    function my_function( $field_group ) {
        $field_group['style'] = 'seemless';
        $field_group['menu_order'] = 1;
        $field_group['hide_on_screen'] = array('the_content');
        return $field_group;

    Using version 5.9.3 with wordpress 5.5.3

Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Group Options (acf_render_field_wrap) is there an officiel way to do this?’ is closed to new replies.