Skip to content

Instantly share code, notes, and snippets.

@Nikschavan
Created August 30, 2019 09:11
Show Gist options
  • Save Nikschavan/e7e5017627d7cc37d15c395b94eaedaf to your computer and use it in GitHub Desktop.
Save Nikschavan/e7e5017627d7cc37d15c395b94eaedaf to your computer and use it in GitHub Desktop.
Remove CreativeWork schema from Astra Theme
<?php // don't add this line to your file.
add_filter( 'astra_schema_body', '__return_empty_string' );
add_filter(
'astra_attr_post-meta-author',
function( $attr ) {
unset( $attr['itemprop'] );
unset( $attr['itemscope'] );
unset( $attr['itemtype'] );
$attr['class'] = 'posted-by author';
return $attr;
}
);
add_filter(
'astra_attr_commen-meta-author',
function( $attr ) {
$attr['class'] = str_replace( 'vcard ', '', $attr['class'] );
return $attr;
}
);
// Remove userinteraction schema from post comment meta.
add_filter( 'astra_attr_comments-interactioncounter', '__return_empty_array' );
add_filter( 'astra_attr_comments-interactioncounter-interactiontype', '__return_empty_array' );
add_filter( 'astra_attr_comments-interactioncounter-userinteractioncount', '__return_empty_array' );
/**
* Remove CreativeWork schema.
*
* @param Array $attr markup HTML attributes.
* @return Array
*/
function astra_child_remove_creative_work_schema( $attr ) {
unset( $attr['itemscope'] );
unset( $attr['itemtype'] );
return $attr;
}
add_filter( 'astra_attr_article-blog', 'astra_child_remove_creative_work_schema' );
add_filter( 'astra_attr_article-page', 'astra_child_remove_creative_work_schema' );
add_filter( 'astra_attr_article-single', 'astra_child_remove_creative_work_schema' );
add_filter( 'astra_attr_article-content', 'astra_child_remove_creative_work_schema' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment