Archived topic
Schema Markup Best Practice
18 replies · Started by Bobby on October 30, 2020
Hi Team,
We are using Yoast plugin, I understand yoast also adds schema markup
So do we need to disable GP default schema markup (CreativeWork)? Can we use both
Can you suggest few free tools to test schema markup
Hi there,
Our usual recommendation is that if you are adding your own schema, then it's likely a good idea to disable the GP's default schema:
https://docs.generatepress.com/article/generate_schema_type/
https://docs.generatepress.com/article/generate_is_using_hatom/
I don't have a specific recommendation for this. If you google "schema markup testing tool" then there should be quite a few options out there.
Let me know if this helps :)
Hi Leo,
Thanks for that.
Disabled the GP’s default schema. When checked through google structured markup testing tool it still shows CreativeWork. Please advise
So you've added filter code here?
https://docs.generatepress.com/article/generate_schema_type/
How are you adding it? Any caching plugins?
Are you sure it's still coming from GP?
We've provided the solution numerous times and it should definitely work :)
Installed GP in our stage server and testing. Send you link privately
Added above code in function.php file.
No cache issues I could think of.
I adding the php filter code by using a hook element in wp_head.
"creative work" is still showing up.
am I doing it wrong?
thank you
Hi Phillip,
this article explains how to add PHP Snippets such as the add_filter
Thank you. I am aware of the adding-php article - and was hoping that I wouldnt have to install another plugin/childtheme just for this feature.
most php needs I could integrate using GP elements just fine - I guess in this case it doesnt work?
Changes to core functions such as using the add_filter hook has to be applied before the templates are output. Whereas the Hook Element ( add_action ) is applying that code directly into the two.
Child Themes are generally the best way to go. If not the Code Snippets plugin is the next best bet.
Hi Bobby,
the schema is coming from the WP Show Post plugin.
Unfortunately the itemtype is baked into the code. But you can filter its value:
add_filter( 'wpsp_defaults', function( $defaults ) {
$defaults['wpsp_itemtype'] = 'itemtype_value';
return $defaults;
}, 20 );
Hi David,
Applied the code.
Now getting itemtype_value 3 ERRORS. Please advise
Link added
As i said you cannot remove the schema but you can change its itemtype.
This line of the code:
$defaults['wpsp_itemtype'] = 'itemtype_value';
change the itemtype_value to whatever alternative itemtype you want instead of the default CreativeWork
For example itemtype of Article
Hi David,
Tried added below code
add_filter( 'wpsp_defaults', function( $defaults ) {
$defaults['wpsp_itemtype'] = 'relatedLink';
return $defaults;
}, 20 );
Because it's coming from relatedposts
https://schema.org/relatedLink
Google structure markup tool gives error "
relatedLink (The type relatedLink is not a type known to Google.)"
Hi there,
Our current development version has an option to turn off microdata: https://wpshowposts.com/wp-show-posts-1-2-0/
Hi Tom,
Excellent. When are you expecting to release 1.2.0 prod version ?