mycred_get_rank_object_id
Description
This function attempts to convert a given rank name into it’s post object ID. If a post ID is provided, this ID is returned instead. When providing a rank name, make sure the name is exact as names are case sensitive. Supports the Multisite Master Template feature.
This function is only available if the Ranks add-on is enabled.
Available since version 1.7
Returns
(int | bool) The rank post object ID else FALSE
.
Parameters
Param | Type | Required | Description | |
---|---|---|---|---|
function mycred_get_rank_object_id( |
||||
$identifier |
int or string | Yes | Either a rank post object ID or a rank Name |
|
) { ... } |
Examples
Example 1: Get the rank post ID for the rank “Beginner“.
$rank_name = 'Beginner'; $rank_id = mycred_get_rank_object_id( $rank_name );