inc/class-Inform_About_Content.php
public function get_users_by_meta( $meta_key, $meta_value = '', $meta_compare = '', $include_empty = FALSE ) {

		if ( $include_empty ) {
			#get all with the opposite value
			if ( in_array( $meta_compare, array( '<>', '!=' ) ) ) {
				$meta_compare = '=';
			} else {
				$meta_compare = '!=';
			}

			$query         = new WP_User_Query(
				array(
					'meta_key'     => $meta_key,
					'meta_value'   => $meta_value,
					'meta_compare' => $meta_compare,
					'fields'       => 'ID'
				)
			);
			$exclude_users = $query->get_results();

			# get all users
			$query = new WP_User_Query(
				array(
					'fields'  => 'all_with_meta',
					'exclude' => $exclude_users
				)
			);

			return $query->get_results();
		}

		$query = new WP_User_Query(
			array(
				'meta_key'     => $meta_key,
				'meta_value'   => $meta_value,
				'meta_compare' => $meta_compare,
				'fields'       => 'all_with_meta'
			)
		);

		return $query->get_results();
	}
public function get_users_by_meta( $meta_key, $meta_value = '', $meta_compare = '', $include_empty = FALSE ) {

		if ( $include_empty ) {
			#get all with the opposite value
			if ( in_array( $meta_compare, array( '<>', '!=' ) ) ) {
				$meta_compare = '=';
			} else {
				$meta_compare = '!=';
			}

			$query         = new WP_User_Query(
				array(
					'meta_key'     => $meta_key,
					'meta_value'   => $meta_value,
					'meta_compare' => $meta_compare,
					'fields'       => 'ID'
				)
			);
			$exclude_users = $query->get_results();

			# get all users
			$query = new WP_User_Query(
				array(
					'fields'  => 'all_with_meta',
					'exclude' => $exclude_users
				)
			);

			return $query->get_results();
		}

		$query = new WP_User_Query(
			array(
				'meta_key'     => $meta_key,
				'meta_value'   => $meta_value,
				'meta_compare' => $meta_compare,
				'fields'       => 'all_with_meta'
			)
		);

		return $query->get_results();
	}
public function get_users_by_meta ( $ meta_key , $ meta_value = '' , $ meta_compare = '' , $ include_empty = FALSE ) { if ( $ include_empty ) { #get all with the opposite value if ( in_array ( $ meta_compare , array ( '<>' , '!=' ) ) ) { $ meta_compare = '=' ; } else { $ meta_compare = '!=' ; } $ query = new WP_User_Query ( array ( 'meta_key' => $ meta_key , 'meta_value' => $ meta_value , 'meta_compare' => $ meta_compare , 'fields' => 'ID' ) ) ; $ exclude_users = $ query -> get_results ( ) ; # get all users $ query = new WP_User_Query ( array ( 'fields' => 'all_with_meta' , 'exclude' => $ exclude_users ) ) ; return $ query -> get_results ( ) ; } $ query = new WP_User_Query ( array ( 'meta_key' => $ meta_key , 'meta_value' => $ meta_value , 'meta_compare' => $ meta_compare , 'fields' => 'all_with_meta' ) ) ; return $ query -> get_results ( ) ; }
get users by meta key

@since 0.0.5

@param string $meta_key
@param string $meta_value (Optional)
@param string $meta_compare (Optional) Out of '!=', '<>' OR '='
@param bool $include_empty (Optional) Set to TRUE to retrieve Users where the meta-key has not been set yet

@return array of user-objects
get users by meta key