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


(int | bool) The rank post object ID else FALSE.


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

) { ... }


Example 1: Get the rank post ID for the rank “Beginner“.

$rank_name = 'Beginner';
$rank_id   = mycred_get_rank_object_id( $rank_name );