custom except %currentmonth%

#240537
  • Resolved Kids Act Club
    Rank Math free

    Hello I would like to change the %crurrentmonth% from Letter to Number, How would I do it.
    https://support.rankmath.com/ticket/variable-currentmonth-custom/ Also I follow the instruction from this thread and added the code however it does not seem to work when I type : %current_month_custom% nothing show up.

    The COde :

    add_action( ‘rank_math/vars/register_extra_replacements’, ‘register_custom_rep’ );
    function register_custom_rep() {
    RankMath\Helper::register_var_replacement(
    ‘current_month_custom’,’get_current_month_custom’,
    array(
    ‘name’ => esc_html__( ‘Current Month’, ‘rank-math’ ),
    ‘desc’ => esc_html__( ‘Current server month’, ‘rank-math’ ),
    ‘example’ => current_time( ‘F’ ),
    )
    );}
    function get_current_month_custom() {
    if ( ! isset( $replacement ) ) {
    $replacement = date(‘n’);
    }

    return $replacement;
    }

Viewing 1 replies (of 1 total)
  • Ankit
    Rank Math business

    Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention.

    I cannot replicate the issue on my end, I have tried your code, and it the digit appears in the page title.

    Although I have noticed the number doesn’t render on the backend, in order to do that, you would need to replace the 8th line from ‘example’ => current_time( ‘F’ ), to 'example' => date( 'n' ),.

    Hope that helps. Thank you and please don’t hesitate to contact us if you need further assistance.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this ticket.