gravityflowchecklists_user_admin_checklists_url

Description

The gravityflowchecklists_user_admin_checklists_url filter allows developers to modify the checklists URL in the WordPress user admin row actions.

Usage

add_filter( 'gravityflowchecklists_user_admin_checklists_url', 'custom_function', 10, 3 );

Parameters

ParameterTypeDetails
$urlstringThe checklists URL for the user admin row action.
$actionsarrayAn array of action links to be displayed.
$user_objectWP_UserWP_User object for the currently-listed user.

Examples

Modify the checklist’s URL to add custom parameters.

add_filter( 'gravityflowchecklists_user_admin_checklists_url', 'gfw_filter_checklists_user_admin_url', 10, 3 );
function gfw_filter_checklists_user_admin_url( $url, $actions, $user_object ) {
	// Add a custom parameter to track source
	$url = add_query_arg( 'source', 'user_admin', $url );
	
	// Add user role as parameter
	$user_roles = $user_object->roles;
	if ( ! empty( $user_roles ) ) {
		$url = add_query_arg( 'user_role', $user_roles[0], $url );
	}
	
	return $url;
}

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 gravityflowchecklists/class-checklists.php