mycred_get_rank

Description

This function will return the myCRED Rank Object for a given rank ID. Uses the mycred_get_rank_object_id function to convert rank names to rank IDs.

This function is only available if the Ranks add-on is enabled.

Available since version 1.1

Returns

(bool | object) FALSE if the provided rank ID is invalid or the myCRED_Rank object.

Parameters

Param Type Required Description
function mycred_get_rank(
$rank_identifier - Yes

Either the rank post object ID or the ranks name (case sensitive).

) { ... }

Examples

Example 1: Get the rank object for the rank called “Master“.

$rank_id = 'Master';
$rank    = mycred_get_rank( $rank_id );