Documentation > Developers > Filter Examples > Collection List Shortcode: Automatically Filter by Current User’s Email Address

Collection List Shortcode: Automatically Filter by Current User’s Email Address

function my_picu_list_collections_args( $args ) {

	if ( isset( $current_user->user_email ) ) {

		$args['meta_query'] = array(
			'relation' => 'AND',
			array(
				'key' => '_picu_collection_email_address',
				'value' => $current_user->user_email
			)
		);
	}

	return $args;
}

add_filter( 'picu_list_collections_args', 'my_picu_list_collections_args' );Code language: PHP (php)

Need help?

If you couldn’t find what you were looking for and need more assistance, please get in touch with us directly and we’re happy to help.