Created
October 18, 2022 11:24
-
-
Save koen12344/dc1503b3e9d1b4154f8a7e7b1b331be7 to your computer and use it in GitHub Desktop.
Add yoast seo description to post to GMB plugin
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 | |
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