Rank Math Dashboard not showing content – abs() error

#1055248
  • Resolved Burak Cihan
    Rank Math pro

    Hello,

    In the “Dashboard” section of the Rank Math plugin, the content and widgets were not loading — everything was blank.

    While checking for the issue, I found the following warning in the debug.log file:

    abs() expects parameter 1 to be numeric, string given
    This error appears around line 339 in the file class-analytics.php.

    As a temporary fix, I modified the line to:

    abs((float)$value1 - (float)$value2);

    After this change, the dashboard content started to display correctly again.

    However, I don’t know why this issue occurred. Is it because Google Analytics data is missing or is there a problem with how the data is handled?

    Here’s what I’d like to ask:
    1. Can you explain the root cause of this issue?
    2. Will there be a permanent fix in a future update?
    3. What is the best way to avoid such errors going forward?

    Both Rank Math and WordPress are up to date.

    Thank you.

    Screenshot: https://imgur.com/a/JPjLLhs

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

    We apologize for the issue you are facing with the Rank Math Dashboard. Thank you for providing detailed information about the error and your temporary fix.

    1. Root Cause: The warning abs() expects parameter 1 to be numeric, string given indicates that the function abs() is receiving a string value instead of a numeric value. This can happen if the data being processed from Google Analytics is not in the expected format, possibly due to missing or malformed data. If the data from Google Analytics is not properly fetched or if there are discrepancies in the data types being returned, it can lead to such warnings.

    2. Permanent Fix: While I cannot provide specific details about future updates, our development team is continuously working on improving the plugin and addressing issues like this. It’s advisable to keep an eye on the changelog for updates that may address this specific issue.

    3. Avoiding Errors: To minimize such errors in the future, ensure that your Google Analytics account is properly set up and that there are no discrepancies in the data being reported. Regularly check for updates to both Rank Math and WordPress, as updates often include bug fixes and improvements. Additionally, consider monitoring your debug logs for any warnings or errors that may arise after updates or changes to your site.

    If you continue to experience issues or have further questions, please reply to this ticket, and a human agent from our support team will assist you further.

    Thank you for your understanding!

    Sources:
    Fatal Error Happening on Some Installations After 1.0.49 Update » Rank Math

    Hello,

    This issue could be caused by conflicting plugins/themes on your website. Kindly make sure you are using the latest version of all the plugins and themes, please update if not yet.

    Here’s a guide for troubleshooting further if the issue persists:
    https://rankmath.com/kb/check-plugin-conflicts/

    You can also follow the steps in this video:
    https://www.youtube.com/watch?v=FcIWRhcUP2c

    Only the site admin would know and your users won’t be affected by this troubleshooting.

    Let us know how it goes. Looking forward to helping you.

    Thank you.

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    I changed the theme and I already had 2 plugins, I removed them but my problem was not solved.

    Hello,

    Our development team is already aware of this issue, and they are working on a fix for this.

    For now, you may patch this by changing the file seo-by-rank-math/includes/modules/analytics/class-analytics-common.php lines 339 and 340

    from:

    $difference = isset( $item['difference'] ) ? abs( $item['difference'] ) : 0;
    $is_negative = isset( $item['difference'] ) && abs( $item['difference'] ) !== $item['difference'];

    to:

    $difference = isset( $item['difference'] ) && 'n/a' !== $item['difference'] ? abs( $item['difference'] ) : 0;
    $is_negative = isset( $item['difference'] ) && 'n/a' !== $item['difference'] && abs( $item['difference'] ) !== $item['difference'];

    We apologize for any inconvenience that might have been caused as a result of this issue.

    Thank you.

    Thank you

    Hello,

    We are glad that helped.

    Please feel free to reach out to us again in case you need any other assistance.

    We are here to help.

    Thank you.

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

The ticket ‘Rank Math Dashboard not showing content – abs() error’ is closed to new replies.