WC_API_Customers::modify_user_query( WP_User_Query $query )

Modify the WP_User_Query to support filtering on the date the customer was created


Description Description


Parameters Parameters

$query

(Required)


Top ↑

Source Source

File: includes/legacy/api/v2/class-wc-api-customers.php

	public function modify_user_query( $query ) {

		if ( $this->created_at_min ) {
			$query->query_where .= sprintf( " AND user_registered >= STR_TO_DATE( '%s', '%%Y-%%m-%%d %%H:%%i:%%s' )", esc_sql( $this->created_at_min ) );
		}

		if ( $this->created_at_max ) {
			$query->query_where .= sprintf( " AND user_registered <= STR_TO_DATE( '%s', '%%Y-%%m-%%d %%H:%%i:%%s' )", esc_sql( $this->created_at_max ) );
		}
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.