Last active
October 3, 2018 04:50
-
-
Save schemapress/7a56d7f6d4796bf1daf60f8e9ca038f6 to your computer and use it in GitHub Desktop.
Override Schema description value with Yoast SEO description 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_output', 'schema_wp_override_description_yoast_seo_12345' ); | |
/* | |
* Override Schema description value with Yoast SEO description | |
*/ | |
function schema_wp_override_description_yoast_seo_12345( $schema_output ) { | |
// get description value from Yoast SEO post meta | |
$desc = get_post_meta( get_the_ID(), '_yoast_wpseo_metadesc', true); | |
// override the value in schema output | |
$schema_output["description"] = $desc; | |
// return our schema array | |
return $schema_output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks, work it