Multiple Toolset custom fields in schema

#754685
  • Resolved WeCruit
    Rank Math pro

    I’d like to use multiple custom fields created in Toolset in a custom schema for JobPosts. I saw the code snippet for a single custom field. Is there something to add multiple fields?
    Would I then be able to add these to a custom schema? How would I add them?
    Thanks.

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

    I apologize for the issue you are facing. To add multiple custom fields created in Toolset to a custom schema for JobPosts, you can follow these steps:

    1. Adding Multiple Custom Fields:
      • You can use the Custom Schema Generator in Rank Math to include multiple items as an array in the Schema.
      • Add multiple property groups under a Schema to include multiple custom fields.

    Array in Custom Schema Generator

    1. Adding Custom Schema:
      • Once you have added multiple custom fields as an array, click the Save button to save your changes.
      • Rank Math’s Custom Schema Generator will automatically add it as an array in the Schema code.

    Code Validation

    If you have any specific requirements or need further assistance with adding multiple Toolset custom fields to a custom schema, please let us know. Thank you for raising this concern.

    Best regards.

    Sources:
    JobPosting Schema Type » Rank Math
    How to Use Rank Math’s Custom Schema Generator » Rank Math
    Configuring “Schema Markup” in Rank Math » Rank Math

    WeCruit
    Rank Math pro

    Sorry, but that’s not at all what I’m needing.
    I found the following from the support bot and need to know how/if it can be used with multiple custom fields.

    To use Toolset custom fields in the Schema Generator of Rank Math, you can define a new variable using a filter to get the value from the Toolset custom field and incorporate it into the Schema. Here’s an example of how you can achieve this:

    add_filter( ‘rank_math/json_ld’, function( $data, $jsonld ) {
    // Check if Toolset custom field exists
    if( function_exists( ‘types_render_field’ ) ) {
    $custom_field_value = types_render_field( ‘your-custom-field-slug’, array( ‘output’ => ‘raw’ ) );

    // Add the custom field value to the Schema
    $data[‘customField’] = $custom_field_value;
    }

    return $data;
    }, 10, 2 );

    Hello,

    Thank you for contacting Rank Math support.

    You don’t need to use code or create a custom variable. You can use the %customfield(field-name)% variable in the Schema fields to add the value from custom fields. Please make sure to replace the field-name with the actual name of the field in the variable.

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

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

The ticket ‘Multiple Toolset custom fields in schema’ is closed to new replies.