gform_author_dropdown_args

Description

The gform_author_dropdown_args filter allows developers to change the list of authors displayed in the author drop down for the Post Fields, by filtering the $args parameter passed to the wp_dropdown_users() function. It runs when the form editor is loaded and the author drop down is created.

Usage

Applies to all forms.

add_filter( 'gform_author_dropdown_args', 'set_users' );

Applies to a specific form. In this case, form id 5.

add_filter( 'gform_author_dropdown_args_5', 'set_users' );

Parameters

ParameterTypeDescription
$argsarrayThe args to be filtered, in the format expected by the wp_dropdown_users() WordPress function.

Examples

Include two specific users in the author drop down.

add_filter( 'gform_author_dropdown_args', 'set_users' );
function set_users( $args ) {
	$args['include'] = '1,8';
	return $args;
}

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Source Code

This filter is located in form_detail.php.