Skip to content

Instantly share code, notes, and snippets.

@schemapress
Last active September 8, 2017 01:16
Show Gist options
  • Save schemapress/96a723402681726029d59e1aeb8250a1 to your computer and use it in GitHub Desktop.
Save schemapress/96a723402681726029d59e1aeb8250a1 to your computer and use it in GitHub Desktop.
Override Knowledge Graph markup output https://schema.press
<?php //* do not include php tag
// First: we remove the Knowledge Graph markup
remove_filter( 'schema_wp_filter_output_knowledge_graph', 'schema_wp_do_output_knowledge_graph' );
// Second: we output the Knowledge Graph markup everywhere on the website
add_filter( 'schema_wp_filter_output_knowledge_graph', 'schema_wp_do_output_knowledge_graph_71837615376457563' );
/*
* Output Knowledge Graph markup, this function overrides Schema output
* so we can control where it should shown (not only the front page)
*
* @since 1.6.9.2
*/
function schema_wp_do_output_knowledge_graph_71837615376457563( $knowledge_graph ) {
if ( ! class_exists( 'Schema_WP' ) )
return; // Schema not present
return $knowledge_graph;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment