403 error importing Yoast SEO Scores – but I might know what’s happening

#990273
  • Resolved Joe Unander
    Rank Math free

    Hi There,

    Hopefully this is helpful: I was just doing a new install of RankMath on a client site today, and I kept running into a 403 error when trying to import the Yoast SEO Scores (all the other imports worked without issue). The odd thing is that I was testing RankMath on the client’s staging site a few days ago, and the SEO Score import worked great. Then I realized you had a recent update, and so I diffed the two versions, and discovered that there is a new callback that appears to be for sanitizing incoming arguments:


    register_rest_route(
    $this->namespace,
    '/updateSeoScore',
    [
    'methods' => \WP_REST_Server::EDITABLE,
    'callback' => [ $this, 'update_seo_score' ],
    'permission_callback' => [ $this, 'can_edit_posts' ],
    'args' => $this->get_update_seo_score_args(), <--- new to version 1.0.240
    ]
    );

    Doing a little logging via the rest_request_before_callbacks hook, it looks like this callback is messing with the parameter structure of the posted score data. Here’s what the posted data looks like when using version 1.0.239 (i.e. what’s on my client’s staging site):


    {"post_scores":{"1535":"70","1585":"58","3557":"11","2909":"66","5777":"77","6892":"66"...}

    …and here’s what it looks like using version 1.0.240:


    "post_scores":["70","58","11","66","77","66"...]

    So you can see that args callback is somehow dropping the key on that posted data, which means the callback permissions is looking at post ids like 0 and 1 instead of 1535 and 1585.

    As a temporary fix, I tried commenting out that args callback, get_update_seo_score_args(), and sure enough, that worked. But obviously it would be great to fix whatever is breaking the incoming posted data in get_update_seo_score_args(), so we can get that in a future update.

    Thanks for a great plugin overall!

    Joe

Viewing 1 replies (of 1 total)
  • Hello,

    We apologize for the issue you are facing with the 403 error while importing Yoast SEO Scores. Thank you for providing such detailed information about the problem and your findings regarding the recent update.

    It seems like the changes in version 1.0.240, particularly with the get_update_seo_score_args() callback, are affecting how the posted data is structured, which is likely causing the permission callback to fail due to incorrect post IDs being sent.

    As a temporary workaround, commenting out the args callback has helped you, but we understand that a permanent fix is necessary. We appreciate your insights and will ensure that this feedback is passed along to our development team for further investigation.

    In the meantime, if you encounter any other issues or need further assistance, please feel free to reply to this ticket, and a human agent from our support team will take over and assist you further. If you could also provide the URL of the site where this issue is occurring, it would be helpful for troubleshooting.

    Thank you for your understanding and for raising this concern!

    Sources:
    Solving Redirection Issues Using Rank Math SEO Plugin » Rank Math

    This is an automated reply from Rank Math Support Bot. If you need further assistance, please reply to this topic and a human support agent will reply to you shortly.

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

The ticket ‘403 error importing Yoast SEO Scores – but I might know what’s happening’ is closed to new replies.