- Add an Extra Field for a Schema Type
- Enable/Disable Schema Markup
- Add Ratings Using Shortcode
- Disable a Specific Schema Markup
- Add Schema Markup on Subcategories
- Disable the White Label Settings
- Disable Corporate Contact Schema
- Remove Home List Item from Breadcrumblist Schema
- Remove Shop Item Link on Product Page
- Test a Schema Snippet
- Mapping Your Schema Fields
- Add an Extra Field for a Schema Type
- How to Use the Schema Pro plugin?
- All-in-one Schema Pro plugin
- Map Required fields with Custom Fields
- Create a Custom Fields
- Target Specific Areas of the Website
- Enable/Disable Schema Markup
- Add Ratings Using Shortcode
- Implement Breadcrumbs
- Disable Schema Markup on AMP Pages/Posts
- Plugin Settings for Schema Pro
- Restrict Schema Pro Settings for Specific User Roles
- Remove Home List Item from Breadcrumblist Schema
- How to Delete Schema Data?
- Regenerate Schema
- Configure Schema on a Single Page/Post
- Skip Rendering Invalid Schema
- Handle Errors & Warnings in a Testing Tool
- Configure WooCommerce
- Repeater Fields Controls on Pages/Posts
- WooCommerce Review Field Schema Markup
- Custom Schema Markup
- Compatibility with External plugins
- Rollback Schema Pro Plugin to Previous Version
- How to White Label Schema Pro
- Important Update: Sitelinks Search Box Deprecation
- Knowledge Graph with Schema Pro
- Configuring WooCommerce with Schema Pro Plugin
- How to Add a Schema markup for an Article on your website?
- What is the Difference between the Free and Pro Plugin?
- How to map fields with custom fields from third party plugins?
- Accept User Ratings from Users
- Update Schema Pro
- Register Your Copy of Schema Pro
- Organization Type in the Setup Wizard
- Schema Pro Setup Wizard
- Getting Started With Schema Pro
- How To Install Schema Pro Plugin
- Schema Markup for an Event page
- Schema Markup for a Review page
- Schema Markup for a Local Business Page
- Schema Markup for a Service Page
- Schema Markup for a Product Page
- Schema Markup for a Course page
- Schema Markup for a Recipe Page
- Schema Markup for a Person/ About Page
- Schema Markup for a Job Posting Page
- Schema Markup for a Video Object
Add an Extra Field for a Schema Type
Schema Pro allows you to add an extra field for a particular schema type.
You will need to use 2 filters to be able to add an extra field.
- wp_schema_pro_schema_meta_fields: This filter is used to add your extra field for mapping.
- wp_schema_pro_schema_{$schema_type}: This filter is used to map the extra field with schema field. Here $schema_type should be replaced with your schema type for which you wish to add an extra field. You can use the following schema types.
article
,book
,course
,event
,job_posting
,local_business
,review
,person
,product
,
recipe
,service
,software_application
,video_object
Here is an example you can refer to:
Example: Add a field workExample
in local_business
Schema type. Add following code in your functions.php file. Here work-example
is used as a key for the workExample
field.
add_action( 'after_setup_theme', 'add_my_custom_meta_field' ); function add_my_custom_meta_field() { add_filter( 'wp_schema_pro_schema_meta_fields', 'my_extra_schema_field' ); add_filter( 'wp_schema_pro_schema_local_business', 'my_extra_schema_field_mapping', 10, 3 ); } /** * Add fields for mapping. * * @param array $fields Mapping fields array. * @return array */ function my_extra_schema_field( $fields ) { $fields['bsf-aiosrs-local-business']['subkeys']['work-example'] = array( // `bsf-aiosrs-book` used for Book, `bsf-aiosrs-event` will for Event like that. 'label' => esc_html__( 'workExample', 'wp-schema-pro' ), // Label to display in Mapping fields 'type' => 'text', // text/date/image 'default' => 'none', 'required' => true, // true/false. ); return $fields; } /** * Mapping extra field for schema markup. * * @param array $schema Schema array. * @param array $data Mapping fields array. * @return array */ function my_extra_schema_field_mapping( $schema, $data, $post ) { if ( isset( $data['work-example'] ) && ! empty( $data['work-example'] ) ) { // For date/text type field $schema['workExample'] = esc_html( $data['work-example'] ); // For image type field // $schema['workExample'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['work-example'] ); } return $schema; }
Was this doc helpful?
What went wrong?
We don't respond to the article feedback, we use it to improve our support content.
On this page