Skip to content

Instantly share code, notes, and snippets.

@schemapress
Last active October 3, 2018 04:50
Show Gist options
  • Save schemapress/7a56d7f6d4796bf1daf60f8e9ca038f6 to your computer and use it in GitHub Desktop.
Save schemapress/7a56d7f6d4796bf1daf60f8e9ca038f6 to your computer and use it in GitHub Desktop.
Override Schema description value with Yoast SEO description https://schema.press
<?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;
}
@SardarDelha
Copy link

SardarDelha commented Jan 31, 2018

thanks, work it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment