Change schema type for specific category
-
I am trying to change the schema of the article piece, e.g. change Type to Event. But I don’t need this for all articles, I can only do it from the category “seminar”. Here is my approach:
add_filter( ‘wpseo_schema_article’, ‘change_article_to_event_if_seminar_category’ );
function change_article_to_event_if_seminar_category( $data ) {
if ( has_category( ‘seminar’ ) ) {
$data[‘@type’] = ‘Event’;
}return $data;
}Translated with DeepL.com (free version)
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Change schema type for specific category’ is closed to new replies.