Conflict with RankMath and Products

#850715
  • Resolved Jellyhound Support
    Rank Math business

    Hey,

    On the website: https://www.paulheatrecovery.co.uk/

    When we have the RankMath schema enabled, it causes some child products to return critical errors.

    The main issue was the assumption that all inputs were arrays, which was not always the case. By adding type checks and recursively sanitising the data, we ensured that the schema data was correctly handled, preventing TypeError and improving the robustness of the code. This approach also involved logging errors when JSON decoding failed, which helps in diagnosing and fixing data issues more effectively.

    However, when we update the plugin, we will need to manually replace the file each time since it will be overwritten.

    Do you have any suggestions on how we can put a long-term solution in place which does not involve manually replacing files each update?

    Thanks,

    Shaun
    Jellyhound

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

    We apologize for the issue you are facing with Rank Math and the critical errors on your child products. Thank you for raising this concern.

    To address the problem of having to manually replace files after each update, we recommend using a custom code snippet in your theme’s rank-math.php file. This way, you can implement your changes without directly modifying the plugin files, which will be overwritten during updates.

    Here’s how you can do it:

    1. Create or Edit the rank-math.php File: If you haven’t already, create a rank-math.php file in your theme’s directory (/wp-content/themes/your-theme-name/rank-math.php). You can follow this tutorial to create the Rank Math file.
    2. Add Your Custom Code: In this file, you can add your custom code that includes type checks and sanitization for the schema data. This will ensure that your modifications persist through updates.
    3. Use Hooks: Utilize WordPress hooks to modify the behavior of Rank Math without altering its core files. For example, you can use filters to adjust the schema output as needed.

    By following this approach, you can maintain your customizations while ensuring that they are not lost during plugin updates. If you need further assistance with specific code snippets or implementation, feel free to reach out to our support team directly.

    We hope this helps you find a long-term solution! If you have any more questions or need additional support, please let us know.

    Best regards!

    Sources:
    How to Fix "Invalid object type for field ‘item’" » Rank Math
    Resolving Rank Math Schema Markup Related Issues

    Thanks

    Hello,

    It seems like you’ve marked this ticket as resolved.

    Can you please confirm if you still need our assistance with this issue or anything else?

    Looking forward to hearing back from you.

    Thank you.

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

You must be logged in to reply to this ticket.