Error message on category pages

#103613
  • Resolved CyrenMedia Profile
    Rank Math free

    Hello, I am getting this message on my category pages, do you know how can I fix?

    Undefined index: @type in /home/masterda/public_html/wp-content/plugins/seo-by-rank-math/includes/modules/schema/class-frontend.php on line 200

Viewing 8 replies - 1 through 8 (of 8 total)
  • Febby
    Rank Math free

    Hello,

    Thank you for contacting the support and sorry for any inconvenience that might have been caused due to that.

    Sorry for the issue you are facing.

    Assuming you are using the latest version of all the plugins and the themes (please update if not yet), it would seem like a conflict with one of the plugins or the theme you are using.

    To determine that, please follow this troubleshooting guide:
    https://rankmath.com/kb/check-plugin-conflicts/

    Please let us know if you find the culprit.

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

    Looking forward to helping you.

    Hi Febby,

    Thanks for the feedback, I managed to install the HealthCheck plugin and become myself familiar with the Debug mode so at least the error message wont appear to my visitors.

    After checking a bit more on the source file ‘class-frontend.php’ it seems as the code which produces this error is the following:

    return ‘FAQPage’ === $schema[‘@type’];

    Any ideas on what might be wrong to this line of code so I can fix and upload?

    Best Regards
    Nikos

    Hi there. I’m also seeing this notice on a clean WordPress instance with WooCommerce and a scratch built minimal theme.

    It’s a simple undefined index notice which I’m sure the plugin developers will be able to sort out.

    A quick solution is to change line 200 to:

    if (isset($schema['@type'])) return 'FAQPage' === $schema['@type'];

    Hello,

    We are glad that you found the solution.

    If you need further help or with anything else, please open a new support ticket here so we can help:

    https://support.rankmath.com

    We are always here for assistance.

    Hello,

    All schema types have @type and it is a required property. Adding an isset condition in class-frontend.php will fix the error but in the Structured data testing tool, you will still get errors.

    Have you added any custom schema in the post or anywhere on the site? Can you add your site’s admin access details in the Sensitive Data Section so we can take a look at the Settings on your site?

    Looking forward to helping you.

    Some further information in relation to this. I believe the following schema is being defined by WooCommerce:

    Array
    (
        [@context] => https://schema.org/
        [@graph] => Array
            (
                [0] => Array
                    (
                        [@type] => Product
                        [name] => 
                        [url] => [removed from example]
                        [@id] => [removed from example]
                        [description] => 
                    )
    
            )
    
    )

    I don’t know enough about schema markup to say whether this valid or not, but it looks like WooCommerce is defining a schema differently to how you are expecting, with the @graph array containing potentially multiple schemas?

    Hello,

    We were able to reproduce the error and have logged it. Please allow us some time to test and release a fix. It should be added to the plugin in the upcoming update.

    For now to fix this issue please add following filter code to your theme’s functions.php file:

    
    add_filter( 'rank_math/json_ld', function( $data ) {
    	if ( isset( $data['ProductsPage'] ) ) {
    		$data['ProductsPage']['@type'] = '';
    	}
    	return $data;
    }, 98 );
    

    I hope that helps. If you need any other assistance, please feel free to let us know. We are here to help.

    Hello,

    We just wanted to let you know that we have fixed this issue in the latest 1.0.55 version of Rank Math plugin.

    If the issue persists, please do not hesitate to open a new ticket.

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

The ticket ‘Error message on category pages’ is closed to new replies.