Support

Account

Home Forums Backend Issues (wp-admin) Alter field group settings per content type Reply To: Alter field group settings per content type

  • Hi John. Thanks for jumping in. We’re using a custom plugin to include the json save and load.

    function ts_acf_json_load( $paths ) {
    	$paths[] = trailingslashit( WP_CONTENT_DIR ) . 'acf-json';
    	return $paths;
    }
    add_filter( 'acf/settings/load_json', 'ts_acf_json_load' );

    Then, in the functions.php within the theme, we have this code to alter it for a specific post type.

    function toind_get_flexible_content( $field_group ) {
    	if ( 'group_5c76d2e8213cf' === $field_group['key'] && 'event' == $GLOBALS['post_type'] ) {
    		$field_group['menu_order'] = 7;
    		$field_group['position']   = 'normal';
    	}
    	return $field_group;
    }
    add_filter( 'acf/get_field_group', 'toind_get_flexible_content' );