|
/ Documentation /Developers/ How to disable a specific schema markup from post/page?

How to disable a specific schema markup from post/page?

In Schema Pro version 1.1.4 following filters are introduced which will help you to disable specific schema from page/post using schema name or post ID.

wp_schema_pro_schema_enabled
wp_schema_pro_global_schema_enabled

Below is the detailed description for above filters –

1.  wp_schema_pro_schema_enabled

With this filter, you will be able to remove specific schema from page/post.

You can use the following schema types.
article, book, course, local-business, review, person, product, recipe, service, software-application, video-object

You can remove more than one schema with adding OR(||) condition.

Example: Below is the example code. You can try adding the following code to your theme’s functions.php file.

function my_function( $bool, $post_id, $type ) {
	if( 'job-posting' == $type || 'event' == $type ){
		return false;
	} else {
		return true;
	}
}
add_filter( 'wp_schema_pro_schema_enabled',  'my_function', 20, 3 );

2. wp_schema_pro_global_schema_enabled

With this filter, you will be able to remove specific global schema from page/post.

You can use the following schema types.
breadcrumb, site-navigation-element, organisation, about-page, contact-page, sitelink-search-box, person

You can remove more than one schema with adding OR(||) condition.

Example: Below is the example code. You can try adding the following code to your theme’s functions.php file.

function wp_my_function( $bool, $post_id, $type ) {
	if( 'site-navigation-element' == $type || 'breadcrumb' == $type ){
		return false;
	} else {
		return true;
	}
}
add_filter( 'wp_schema_pro_global_schema_enabled',  'wp_my_function', 20, 3 );
Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
On this page
Scroll to Top