Schema doesn’t pick custom fields from custom post type set to product

#581778
  • Resolved Anonymous
    Rank Math free

    I have set my custom post type to product in schema setting but it doesn’t pick price, is there a any way I can assign price?

    I have a Ad posting website and custom post type which is product but after assigning product in Schema setting it’s still showing as Article in Google Schema tester. My website link is https://adlagao.pk/

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

    Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for any inconvenience this issue may have caused you.

    I’ve checked your ads, and Rank Math’s unable to include the schema on your site. The product schema on your site could be coming from one of your plugins/theme.

    Assuming you are using the latest version of all the plugins and the themes (please update if not yet), to determine that, please follow this troubleshooting guide:
    https://rankmath.com/kb/check-plugin-conflicts/

    Here is a video you can follow as well: https://www.youtube.com/watch?v=FcIWRhcUP2c

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

    Let us know how this goes.

    Thank you.

    Anonymous
    Rank Math free

    I have added custom json schema of product type as plugin was unable to detect it, is there any way we can create a schema template with custom fields?

    Hello,

    If you’re referring to schema templates in Rank Math, that is only available in the Rank Math PRO plugin:
    https://rankmath.com/kb/schema-templates/

    Meanwhile, it’s possible to create a custom template that applies to all the ads and if the data are saved in the database in custom fields, it’s possible to retrieve it dynamically using this variable: https://rankmath.com/kb/variables-in-seo-title-description/#custom-field-advanced

    However, since Rank Math’s unable to show the schema on your ads pages’ source code, then the steps mentioned above would not work as you have applied a custom JSON schema to them.

    Let us know how this goes.

    Thank you.

    Anonymous
    Rank Math free

    I have tried this function %customfield(field-name)% but it prints it as it is instead of printing value of that field
    Main issue is Type is set to Product but it’s showing as Article. Also if you can let me know how to add more meta tags inside generated scehma than that would be great.

    Setting Screenshot:
    https://ctrlv.link/sXJo

    Schema Markup
    https://ctrlv.link/ffEi

    Thank you

    Hello,

    You can refer to our filters here to modify or add meta tags on your site:
    https://rankmath.com/kb/filters-hooks-api-developer/#metadata

    Regarding the og:type, we only use 2 types here, Article and Product. The Product type is for WooCommerce products and for the rest, we use the Article type.

    However, if you wanted to manually update the tag from Article to Product, then you can use this filter:

    add_filter( 'rank_math/opengraph/type', function( $type ) {
     $post_types = ['Ads'];          //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.

    Thank you.

    Anonymous
    Rank Math free

    Okay great, can you also send me some code to inject Price or other custom field in meta tags?

    Anonymous
    Rank Math free

    and I have updated type to product but it’s still not beign detected by google schema tester anyhow Type is updated to Product on frontend
    https://search.google.com/test/rich-results/result?id=zXlkPQmx6QrRXmm3zymK3Q

    Hello,

    The reason why the product does not show schema in the Rich result tool since Rank Math could not include the schema code in your site as mentioned in my previous reply.

    You can verify that by viewing your page’s source code and finding this line if Rank Math generates the schema:

    script type="application/ld+json" class="rank-math-schema"

    Once the product schema is applied, Rank Math automatically adds the necessary metadata to your CPT:

    meta property="product:brand" 
    meta property="product:price:amount"
    meta property="product:price:currency"

    Hope that helps.

    Thank you.

    Anonymous
    Rank Math free

    I have deactivated everything except required plugin and theme but there is no “script type=”application/ld+json” class=”rank-math-schema”

    view-source:https://adlagao.pk/ad/009s-plus-riser-card-pci-e-1x-16x-pcie-card-with-6pin4pin-sata-power-best-riser-for-mining/

    Hello,

    We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below 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 use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    Anonymous
    Rank Math free

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello,

    For the products that are currently missing the Schema markup, you’ll need to remove the current Product Schema and re-add it to the pages.

    We did that for the example URL you shared and the Schema is now showing in the source code of the page.

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

    Anonymous
    Rank Math free

    do I need to do it manually for all ads or is there any automated way?

    Hello,

    In this case, you may need to apply the product schema manually to those ads.

    Our automated way is the bulk edit feature which is only available using the Rank Math PRO version:
    https://rankmath.com/kb/bulk-editing-in-rank-math/#set-schema-markup-to-default-type

    Looking forward to helping you.

    Thank you.

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

The ticket ‘Schema doesn’t pick custom fields from custom post type set to product’ is closed to new replies.