Skip to main content

benecaster_tenure_badge_milestones

Filter Free Since v1.0.0

Filters the milestone threshold map used by TenureBadgeCalculator to derive a subscriber’s tenure badge label. The map is an int-keyed array of months_since_join => label pairs. Core defaults: [ 1 => '1-Month Member', 6 => '6-Month Member', 12 => '1-Year Member', 24 => '2-Year Member', 60 => '5-Year Member', 120 => '10-Year Member' ].

The calculator picks the highest threshold that does not exceed the subscriber’s tenure in months and uses that entry’s label. A subscriber whose tenure is below the lowest threshold receives an empty label — the badge chip is suppressed unless benecaster_tenure_badge_label returns a non-empty string.

Normalization: resolve_milestones() sorts the returned map ascending by threshold, drops entries with non-positive month keys or non-string / empty labels, and falls back to the built-in defaults on a non-array return or when every entry is invalid. Return order does not matter — the calculator always sorts before matching, so an unsorted map is safe.

Parameters

Name Type Default Description
$thresholds array Int-keyed map of months → milestone label string. Core defaults applied when this returns a non-array or an array whose every entry is invalid.

Returns: array

Examples

Replace the default map with quarterly milestones

add_filter( 'benecaster_tenure_badge_milestones', function ( array $default ): array {
    return [
        3  => 'First-Quarter Supporter',
        6  => 'Half-Year Supporter',
        9  => 'Three-Quarter Supporter',
        12 => 'One-Year Anniversary',
        24 => 'Two-Year Anniversary',
    ];
} );

Affects

  • TenureBadgeCalculator::resolve_milestones()