Dynamic Data Retriever Output Formatting Issue

#618118
  • Resolved Anonymous
    Rank Math free

    I have observed that the dynamic data retriever is currently displaying the month (%currentmonth%) as ‘August,’ whereas I would prefer it to show as either ‘Aug’ or ‘AUG.’

    Could you kindly provide guidance on how to modify the dynamic data retriever settings to achieve the desired formatting? I have reviewed the available documentation and settings options, but I have been unable to find a solution to this specific issue.

    Your assistance in resolving this matter would be greatly appreciated. Please let me know if there are any steps or configuration changes I need to make in order to achieve the desired ‘Aug’ or ‘AUG’ format for the dynamic data retriever’s output.

    Thank you for your prompt attention to this matter. I am looking forward to your guidance and solution.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you so much for getting in touch.

    You could change the Date Format by going to your WordPress Dashboard > Settings > General and using a custom Date Format like M d, Y to input the abbreviated month. Like this:
    https://prnt.sc/f6zu-_r2zMzQ

    More on that here:
    https://rankmath.com/blog/change-date-and-time-format/

    Here’s a documentation by WordPress regarding this matter as well:
    https://wordpress.org/documentation/article/customize-date-and-time-format/

    Hope that helps and please do not hesitate to let us know if you need my assistance with anything else.

    Anonymous
    Rank Math free

    Thanks Marlow for your reply,
    But I am specifically talking about this (%currentmonth%) where we dynamically add month in the SEO post/page title!!!

    Your given resolution will only change the date format on wordpess site!!

    Please check this screenshot
    https://snipboard.io/wfNhH0.jpg

    Hello,

    Thank you for that clarification.

    Unfortunately, the functionality of the existing variables like %currentmonth% cannot be modified.

    However, to achieve the structure you have described, then you can create a custom variable using this filter and use it instead:

    add_action('rank_math/vars/register_extra_replacements', function () {
        rank_math_register_var_replacement(
            'currentmonth_short',
            [
                'name'        => esc_html__('Current Month Short form', 'rank-math'),
                'description' => esc_html__('Current month in 3 letter format', 'rank-math'),
                'variable'    => 'currentmonth_short',
                'example'     => currentmonth_short_callback(),
            ],
            'currentmonth_short_callback'
        );
    });
    function currentmonth_short_callback()
    {
        $date = date('M', time());
        return $date;
    }

    After applying the code, you can use the variable %currentmonth_short%.

    Here’s how you can add a filter/hook to your WordPress site:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Hope that helps.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

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

The ticket ‘Dynamic Data Retriever Output Formatting Issue’ is closed to new replies.