Created
September 13, 2017 18:26
-
-
Save schemapress/10b7db18fb8380ffd94b6f0d4dd944c9 to your computer and use it in GitHub Desktop.
Override Schema description value, use full content instead https://schema.press
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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(']]>', ']]>', $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