This function will return a given ranks logo image. Note that this function will return an image HTML element if the rank is found.

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

Available since version 1.1


(bool | string) FALSE if the rank ID is invalid or if the logo is not set else the logo HTML image element.


Param Type Required Description
function mycred_get_rank_logo(
$rank_identifier int or string Yes

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

$size string or array No

The image size. See the get_the_post_thumbnail function for possible values.

$attr array No

Optional image attributes to pass on to get_the_post_thumbnail function.

) { ... }


Example 1: Get a ranks logo in thumbnail size (default).

$rank_id   = 1;
$rank_logo = mycred_get_rank_logo( $rank_id );

echo $rank_logo;

Example 2: Get a ranks logo in full size.

$rank_id   = 'Master';
$rank_logo = mycred_get_rank_logo( $rank_id, 'full' );

echo $rank_logo;