Rankmath giving 500 error

I want to chime in here as well as we are having this same issue. I can confirm that previous versions of the plugins have the same issue and it is a conflict between the X Pro / Child theme and the Rank Math SEO plugin.

It appears to be a result of route that Rank Math uses to update the Meta Data. Rank Math boasts almost 1 million users so I would say that is a reasonable size vendor for X Pro to work with to resolve the issue. Below are what was found during our testing of this problem.

api-fetch.min.js?ver=25cbf3644d200bdc5cab50e7966b5b03:2 POST https://www.writewaypublishing.com/wp-json/rankmath/v1/updateMeta?_locale=user 500

Further review revealed:

We were able to narrow down this issue to a problem with the site’s active theme. We found this fatal error in the logs:

PHP Fatal error: Uncaught Exception: Unable to load content from post. in /www/wp-content/themes/pro/cornerstone/includes/classes/content/class-content.php:58

Looking at the line/block of code referenced in the error, it does look like the function is working as expected:

if ( ! is_a( $post, ‘WP_POST’ ) ) {
throw new Exception( ‘Unable to load content from post.’ );

You are not one of Rank Math’s compatible themes - https://rankmath.com/compatibility/

A conversation on how to have the X Pro theme be compatible with Rank Math would be great.

2 Likes

OK, my 2 cents, ALL of my websites are made using Pro, and all of them have Rank Math, so now I have no way to update the Meta Desc for any of them.
Please, we need you to fix this issue very soon, our businesses are being compromised because of this, we are losing expusure and money.
According to Rank Math, the integration with their plugin is very easy, here you have the documentation

Please, work on this!

2 Likes

Glad to know I am not the only one having issue. x Pro definitely needs to put this on a priority bug fix list. Given the popularity of rankmath and x theme, the theme and plugin have to find a solution for compatibility.

Hi @mcostales84, @klevur,

I have already reported the issue to our Issue Tracker for further investigation by the development team. But we didn’t hear anything on this till now.

Thanks

Any updates?
It’s taking a really long time for bug fixing.

Hi @amanjaura,

Unfortunately, there is no update on this right now.

Thanks

What can be done to expedite this? It’s been almost a month and we can’t update SEO tasks for our websites.

Agreed, I have a lot of unhappy clients…

1 Like

Hello There,

Thanks for updating in!

If you need a temporary workaround, this can be added to the child theme’s functions.php

class RankMath_fix {
	
	protected $post_ID = 0;

	public function __construct() {

		add_filter('rest_pre_dispatch', [$this, 'init'], 0, 3);
		
	}

	public function init ( $null, $server, $request ) {
				
		if ( $request->get_route() == '/rankmath/v1/updateMeta' ){
			$this->post_ID = $request->get_param( 'objectID' );
			add_filter('the_content', [$this, 'content'], 0 );
		}

	}

	public function content ( $content ) {

		if ( doing_action('rank_math/pre_update_metadata') && $this->post_ID > 0 ) {
			$content = strpos( $content, "[cs_content]", 0 ) === false ? $content : str_replace("[cs_content]", "[cs_content _p=\"{$this->post_ID}\" no_wrap=true ]" , $content );
		}

		return $content;
	}

}

new RankMath_fix();

Best Regards.

The temp solutions seems to work. Thank you. Time to add it to all the websites…

Hi @amanjaura,

Glad that it works for you.

Thanks

I am not having luck with this bit of code… can you take a look?

Hi @coloradodesigngroup,

We have checked it by adding the RankMath Meta into a Test Page and found that it is saving properly, which means the added code is working perfectly fine at your end.

image (8)

If that is not working till now, I would request you please provide any video that helps us to recognize and replicate the issue you are having?

Thanks

Sure… here is a link:

Its still not saving the data for me.

You seem to have classic version enabled. I had the default editor. that might be the difference, why the code worked for me.

Hi, thanks… i tried the default and I get this now:

Hi @coloradodesigngroup,

I have added a Focus Keyword to the 404 and Contact Us page and it worked.

If you still facing the same issues in other pages, there might be some other reason behind that and you need to wait for the Theme update with the fix.

Thanks

Right, I tried another page and it also saved. Any idea what the issue is on the About Page? Why would it throw an error?

Hi @coloradodesigngroup,

I have checked the About page and found the issue you specified, there might be something in the Team Sections > Column 3 > Card > Back Content. I have copied the same content into the test page and found it saving if the Back Content is removed.
I would suggest you change the content and check if that resolves your issue.

Hope it helps.
Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.