Can I replace or remove only values of itemtype?
I found your code in another topic, which is looks like what i’ve been searching for:
add_filter( 'generate_body_itemtype', 'tu_custom_body_itemtype' );
function tu_custom_body_itemtype( $type ) {
if ( is_page( array( 'about', 'about-us' ) ) ) {
return 'AboutPage';
} elseif ( is_page( array( 'contact', 'contact-us' ) ) ) {
return 'ContactPage';
} elseif ( is_search() ) {
return 'SearchResultsPage';
} elseif ( is_front_page() ) {
return 'WebPage';
} elseif (is_single() ) {
return 'Article';
} else {
return 'WebPage';
}
}
I’ve tried to add this (with ‘generate_article_schema’ instead ‘generate_body_itemtype’) and previous code in Code Snippet plugin and directly to new plugin file. It still doesn’t work. Do I need to add only this code or somthing else? Or these filters not working now?