Reg : schema not working for custom fields and sub custom fields

#765714
  • Resolved Anonymous
    Rank Math free

    Dear Support Team,

    I have custom field eg accomodation 1 , accomodation 2 and so on and in each accomodation 2 more filed like accomodation description and accomation image.

    https://prnt.sc/YWBwOukVzkkD

    https://prnt.sc/LIiqR5mwRj2D

    So please let me know how can i add schema in rankmath all in one go as i have 15 accomodation , 15 dining custom field and each of them again have 2 (desc & image) ….

    None of my images ranking on google as well.

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

    I apologize for the issue you are facing with adding schema for custom fields and sub-custom fields in Rank Math. To add schema for multiple custom fields and sub-fields in one go, you can follow these steps:

    1. Custom Schema Generator:
      • Edit the post or page where you want to add the custom schema.
      • Navigate to the Schema settings by clicking on the Schema tab and then click on Schema Generator.
      • Click on the Custom Schema tab to open the Schema Builder.
      • In the Schema Builder, you can add properties and property groups by creating new fields. You can start with a blank template and then add your properties and property groups.

    Add Property and Property group

    1. Schema for Custom Post Types:
      • Rank Math fully supports custom posts, including custom fields. Once you register a custom post type, Rank Math will include a section in the Titles and Meta settings where you can configure global options for the custom post type.

    By following these steps, you can add schema markup for your custom fields and sub-fields in Rank Math. If you encounter any difficulties or have further questions, please feel free to reply to this ticket, and a human agent from the Rank Math Support team will assist you further.

    Thank you for raising your concern, and we appreciate your patience as we work to resolve this issue for you.

    If you need further assistance, please let us know.

    Sources:
    Resolving Rank Math Schema Markup Related Issues
    How to Auto-Detect & Auto-Fetch Video Data for Video Schema and Sitemap » Rank Math
    How to Use Rank Math’s Custom Schema Generator » Rank Math
    Configuring “Schema Markup” in Rank Math » Rank Math
    How to Use Rank Math’s Custom Schema Generator » Rank Math

    Hello,

    Thank you for contacting support.

    Please note that our plugin can only add the data from custom fields when they are simple text fields and not galleries like you have for one of the fields.

    That would require additional custom code and a dynamic variable to be created that would extract the image URL from the field to add to the Schema markup, editing the following filter: https://rankmath.com/kb/filters-hooks-api-developer/#add-extra-variables

    For the simple fields that we mentioned above the following variable can be added to the Schema properties: https://rankmath.com/kb/variables-in-seo-title-description/#custom-field-advanced

    Last but not least, to apply this to all the accommodations you would need a template but that is only available in the PRO version of the plugin: https://rankmath.com/kb/schema-templates/

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

    Anonymous
    Rank Math free

    Dear Miguel,

    Sorry to say but i cannot find any video on youtube explaining all in details. This is very common requirement and most of people need this customisation.

    through my site , not a single image is ranking as no schema working.

    I have 15 accommodation on in each accommodation i have few images and yes you are right on it so how can i add that all images too …? This is very common in travel site when all details so there would be multiple images.. How ecomm product site is working with multiple images ? How to get this dynamic code ?

    I will other 2 links but please let me know if there is another way to simply and rank those images too. thanks a lot

    Hello,

    The ranking of images doesn’t depend on whether or not they are added inside the Schema markup. It depends on whether or not Google is able to find them on the pages of your website and they are relevant to search queries where those pages appear.

    If you still want to add those images you would need to hire a developer who is comfortable working with WordPress and can understand technical documentation to modify the filter we shared to create variables that could output those in an acceptable format for Schema.

    The way those images are saved it’s not possible to read them directly without a custom variable or custom code to add them directly to the Schema markup, hence the requirement to either hire a developer or be able to understand WordPress and coding in PHP to perform those actions.

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

    Anonymous
    Rank Math free

    thanks Miguel
    You being really great support and very helpful. As per your last message , so schema wont make difference to rank on google then please let me know what is best way to rank images.

    I spoke to developer and adding custom fields in schema is okay but gallery of images would be very difficult.

    Is there any other alternative to rank images on google or how to find out if my images are ranking.

    Our team really worked hard to get alt tags – correct format file names and we have many images but not any one is appearing on google images which is quite strange. Even added image sitemap on rank math and google console but same issue.

    i appreciate if you can help to resolve this image issue ..thanks

    Hello,

    Thank you for your patience.

    We recommend going through our blog here to optimize your images and increase their potential to rank on search engines:
    https://rankmath.com/blog/image-seo/

    Moreover, the Google image Algorithm works either by scouring for related images based on the user’s search query or by analyzing the image you upload through Google’s reverse image search (Search By Image option).

    Looking forward to helping you.

    Anonymous
    Rank Math free

    Thanks for support

    I have gone through article for images which is all done on our side.

    Issue is schema is not working. In each custom field of accomodation (screenshot shared earlier) …we have 2 -3 images.. .if one image then okay but 2 -3 images on each accomodation is challenge..
    for dining only have 1 image so all good as well.

    I spoke to developer and said they can do 1 images as per rank math but not 2 -3 on each field which is another challenge..

    any solution for that .?

    Hello,

    We understand your concern. Unfortunately, adding multiple images to Schema markup for each custom field presents a technical challenge since you can only include a single image URL in a single schema field. You may need a custom solution from a developer to address this.

    Since you are focusing on the filter code to modify the schema, you can loop the image URL from a single field and create its own imageObject entity. Here’s an example:

    add_filter( "rank_math/snippet/rich_snippet_article_entity", function( $entity ) {
    	// $yourFieldData is the variable to store the custom field for your multiple images
    	foreach ($yourFieldData as $img_url) {
    		$imageData = [
    			"@type" => "ImageObject",
    			"url" => $img_url
    		];
    	}
    
    	if(isset($imageData)) {
    		$entity['image'] = $imageData;
    	}
    
    	return $entity;
    });

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

The ticket ‘Reg : schema not working for custom fields and sub custom fields’ is closed to new replies.