Skip to content

Instantly share code, notes, and snippets.

@schemapress
Created September 13, 2017 18:26
Show Gist options
  • Save schemapress/10b7db18fb8380ffd94b6f0d4dd944c9 to your computer and use it in GitHub Desktop.
Save schemapress/10b7db18fb8380ffd94b6f0d4dd944c9 to your computer and use it in GitHub Desktop.
Override Schema description value, use full content instead https://schema.press
<?php //* do not include php tag
add_filter( 'schema_wp_filter_description', 'schema_wp_override_description_345675432567' );
/*
* Override Schema description value, use full content instead
*/
function schema_wp_override_description_345675432567( $schema_output ) {
global $post;
// get post id
$post_id = $post->ID;
// get post
$content_post = get_post($post_id);
// get post content
$content = $content_post->post_content;
// remove shortcodes
$content = str_replace(']]>', ']]&gt;', $content);
// remove html tags
$content = wp_strip_all_tags($content);
// return new description
return $content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment