Custom Post Type – Product Schema does not stick

#802744
  • Resolved Koolpal
    Rank Math free

    Hi,

    I am not sure what step is missing.

    I am using Rank Math SEO with AI Best SEO Tools – Free – Version 1.0.218

    Under Titles & Meta -> I have a custom post type for which I have select Schema Type as Product

     Titles & Meta for custom post type

    Similarly, I have selected Primary Taxonomy as the Categories used by this custom post type

    Part 1: Product Schema is NOT applied to these posts

    When we create a new post using this custom post type we see that Product Schema in Use
    Shown as Product Schema in Use

    However, we find that there is no schema output when we view source of this post page.

    We need to delete the product schema and click on Schema Generator, select Product + use and then click Save for this Post.

    Now, product schema output is seen when we view source of this post page.

    Doing this manually for each post is going to be too painful for us.

    Part 2: Open Graph shows Article
    <meta property=”og:type” content=”article” />

    If Product Schema was correctly applied, Open Graph should show og:type as product.

    Can you please check and guide how do we fix BOTH Part 1 & Part 2 mentioned above?

    Thank

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

    Thank you for contacting Rank Math support.

    To help you investigate this issue, we might need to take a closer look at your website and settings. Please follow these steps:

    • Edit the first post on this ticket and include your WordPress logins in the Sensitive Data section. This is a secure section that only our support staff can access.
      Sensitive Data Section
    • Make sure you take a complete backup of your website before sharing the information with us.
    • If you prefer, you can use this plugin to generate a temporary login URL to your website and share that with us instead: https://wordpress.org/plugins/temporary-login-without-password/
    • You can also use this plugin to monitor what changes our staff might make on your website (if any): https://wordpress.org/plugins/wp-security-audit-log/

    We appreciate your cooperation and patience. Thank you for choosing Rank Math.

    Koolpal
    Rank Math free

    Hi,

    This is on local development so access cannot be provided.

    Please let me know what steps are missing so that I can fix these.

    Thanks

    Hello,

    1. Please test the content of the schema generated by Rank Math available in the head element of the ‘live’ page. It is within a script tag of type “application/ld+json” with class rank-math-schema. You can test the schema using the Google Rich Results test tool or https://validator.schema.org/

    2. Rank Math only uses 2 types for the og:type meta tag, Article and Product. The Product type is for WooCommerce products, and for the rest, we use the Article type.

    However, if you want to manually update the tag from Article to Product for your “Pages”, then you can use this filter:

    add_filter( 'rank_math/opengraph/type', function( $type ) {
     $post_types = ['page'];          //separate the post types with a comma
    	 if(in_array( get_post_type(), $post_types )){
         return "product";
     }
    	return $type;
    });

    And here’s how you can add the filter:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Hope that helps.

    Koolpal
    Rank Math free

    Hi,

    Thanks for your reply.

    Let’s try to solve this as asked.

    Part 1: Product Schema is NOT applied to these posts
    We need to delete the product schema and click on Schema Generator, select Product + use and then click Save for this Post.

    How do we make it apply product schema automatically without the need to delete product schema and click on Schema Generator, select Product + use and then click Save for each Post – EACH TIME?

    Part 2: Open Graph shows Article
    <meta property=”og:type” content=”article” />
    While waiting for your reply, we have solved this by ourselves

    Can we focus on solving Part 1? Please do read my first message AGAIN if required.

    Thanks

    Hello,

    The Product Schema has some required properties that are not added by default when you use that as the default so you need to edit the current Product Schema to at least include either the offer or reviews for it.

    When you add the Schema manually inside the page and ignore those, the Schema still gets applied because there was already user interaction so the plugin assumes that you are doing this willingly and setting the Product Schema incompletely and inaccurately, but it won’t do it automatically to prevent Schema markup issues caused directly by the plugin without user intervention.

    That’s why it works by removing the Product Schema and adding it again manually or by just hitting the update button on the page after creation.

    The automatic Product Schema only works for WooCommerce Products, and on all other pages needs to be done manually.

    Don’t hesitate to get in touch if you have any other questions.

    Koolpal
    Rank Math free

    Hi,

    It does NOT work as stated by you:

    …by just hitting the update button on the page after creation.

    We are FORCED to delete the product schema and click on Schema Generator, select Product + use and then click Save for this Post.

    How can I automate this? Any code snippet?

    Thanks

    Hello,

    No, this cannot be automated, at least not with the Free version of the plugin. As we mentioned in our reply, the automatic Product Schema only applies to WooCommerce products.

    In the PRO version, you have access to Schema Templates which can be created and applied to a specific set of pages with the correct information: https://rankmath.com/kb/schema-templates/

    Don’t hesitate to get in touch if you have any other questions.

    Koolpal
    Rank Math free

    Thanks

    Hello,

    We are glad to hear that this issue has been resolved. Thank you for letting us know. This ticket will be closed now, but you can always open a new one if you have any other questions or concerns. We are here to help you with anything related to Rank Math.

    We appreciate your patience and cooperation throughout this process.

    Thank you for choosing Rank Math.

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

The ticket ‘Custom Post Type – Product Schema does not stick’ is closed to new replies.