mycred_get_ranks
Description
This function allows you to query existing ranks for a specific point type.
This function is only available if the Ranks add-on is enabled.
Available since version 1.1
Returns
(array) Returns an associative array of rank objects or an empty array if no ranks were found.
Parameters
Param | Type | Required | Description | |
---|---|---|---|---|
function mycred_get_ranks( |
||||
$status |
string | Yes | Rank post object status to query. Defaults to |
|
$number |
int | Yes | Number of ranks to get. Use |
|
$order |
string | No | Sorting order of ranks. Accepts |
|
$point_type |
string | No | Option to return ranks only for a particular point type. By default, this function will return all ranks no matter which point type they belong to. Should only be used if you need to get ranks of a custom point type. |
|
) { ... } |
Examples
Example 1: Get all published ranks.
$ranks = mycred_get_ranks();
Example 2: Get all published ranks for a custom point type
$ranks = mycred_get_ranks( 'publish', -1, 'DESC', 'customtypekey' );
Example 3: Get the 5 lowest ranks.
$ranks = mycred_get_ranks( 'publish', 5, 'ASC' );