Automator_Helpers_Recipe::wp_users( string $limit = 99999 )


Parameters Parameters

$limit

(string) (Optional)

Default value: 99999


Top ↑

Return Return

(array)


Source Source

File: src/core/lib/helpers/class-automator-recipe-helpers.php

	public function wp_users( $limit = 99999 ) {
		global $wpdb;
		// prepare transient key.
		$transient_key = 'automator_transient_users';
		// attempt fetching options from transient.
		$users = get_transient( 'uap_transient_users' );
		if ( empty( $users ) ) {
			$query = apply_filters(
				'automator_get_users_query',
				"SELECT ID, display_name
					FROM $wpdb->users
					ORDER BY display_name
					LIMIT 0, $limit"
			);
			$users = $wpdb->get_results( $query ); //phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared

			// save fetched posts in a transient for 3 minutes for performance gains.
			$expiration_time = apply_filters( 'automator_get_users_expiry_time', 3 * MINUTE_IN_SECONDS, $users );
			set_transient( $transient_key, $users, $expiration_time );
		}

		return apply_filters( 'automator_modify_user_results', $users );
	}