Skip to content

Instantly share code, notes, and snippets.

@koen12344
Created October 18, 2022 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koen12344/dc1503b3e9d1b4154f8a7e7b1b331be7 to your computer and use it in GitHub Desktop.
Save koen12344/dc1503b3e9d1b4154f8a7e7b1b331be7 to your computer and use it in GitHub Desktop.
Add yoast seo description to post to GMB plugin
<?php
function pgmb_add_yoast_description($variables, $parent_post_id){
if(!function_exists('YoastSEO')){ return $variables; }
$description = YoastSEO()->meta->for_post( $parent_post_id )->description;
$variables['%yoast_description%'] = $description;
return $variables;
}
add_filter( 'mbp_placeholder_variables', 'pgmb_add_yoast_description', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment