Update year automatically

#34896
  • Resolved Lisa
    Rank Math free

    Hi, I just recently changed from Yoast to Rank Math and been very happy with it so far. I have on my site the code that will update the year every year automatically whenever instead of typing 2020 I write [year]. But now it’s displaying in the SERPS “[year]” instead of the current year which looks terrible. The code I had to put to funtions.php for Yoast to update the year was this

    //* Activate shortcode function in Yoast Title and Meta Description
    add_filter( ‘wpseo_title’, ‘do_shortcode’ );
    add_filter( ‘wpseo_metadesc’, ‘do_shortcode’ );

    Do you have something like this for RankMath? Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi Lisa,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    You can use the link below to Allow shrtcodes in Meta Data.
    12. Filter to Allow Shortcodes in the Meta Data

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Lisa
    Rank Math free

    Hey, thanks for that. I had a look but I am not so technical, so not really sure how it works. Do I just paste this:
    /**
    * Add item to Rank Math admin bar node.
    *
    * @param array $items Array of nodes for Rank Math menu.
    */
    add_filter( ‘rank_math/admin_bar/items’, function( $items ) {
    return $items;
    });”

    to functions.php and then the current year will be updating automatically? Or do I have to add more to that code? Sorry but I don’t understand.

    Hello,

    Thank you for contacting Rank Math today.

    You can simply add the following code to your theme’s functions.php file:

    add_filter('rank_math/frontend/title', 'do_shortcode' );
    add_filter( 'rank_math/frontend/description', 'do_shortcode' );

    Looking forward to helping you. Thank you.

    ​​​​​​

    Lisa
    Rank Math free

    Thanks a lot!

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)

The ticket ‘Update year automatically’ is closed to new replies.