Bug in seo-by-rank-math-pro get_position_for_badges function

#532623
  • Resolved Anonymous
    Rank Math free

    I work for a hosting company, and we have a customer who uses the “seo-by-rank-math-pro” plugin.

    This customer’s site repeatedly creates more than 6 GB of database temporary tables, which leads to performance problems. We tracked this down to this query being run:

    SELECT page, COUNT(DISTINCT(query)) AS keywords FROM wp_rank_math_analytics_gsc WHERE created BETWEEN 1674000000 AND '2023-02-17 23:59:59' GROUP BY page ORDER BY query DESC LIMIT 0, 5;

    That SQL query comes from the function “get_position_for_badges()” in the “includes/modules/analytics/class-posts.php” file, and it has a bug. The query generates the database warning “Truncated incorrect datetime value: ‘1674000000’” and ignores the beginning time, making it operate on all the rows in the wp_rank_math_analytics_gsc table, instead of just a subset of them.

    Instead of “1674000000”, the query should be using “2023-01-18 00:00:00”, which avoids this problem. The code in the get_position_for_badges() function currently looks like:

    $start = strtotime( '-30 days ', Stats::get()->end );

    … but should have an extra line to convert it to a string like this:

    $start = strtotime( '-30 days ', Stats::get()->end );
    $start = date( 'Y-m-d H:i:s', $start );

    If you could fix this, that would be appreciated.

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

    Thank you for getting in touch and we are sorry to hear about the issue your client is facing.

    We have shared your feedback with the development team and we will fix this issue very soon.

    In the meantime, do not hesitate to let us know if you have any other feedback.

    Hello,

    Thank you for your patience.

    Just a quick update that we have fixed this issue on one of our recent releases.

    Please update Rank Math & all other plugins, themes and WordPress to the latest version.

    The issue should be fixed.

    If not, please feel free to open a support topic or reply to this message and we will be more than happy to assist.

    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 2 replies - 1 through 2 (of 2 total)

The ticket ‘Bug in seo-by-rank-math-pro get_position_for_badges function’ is closed to new replies.