Skip to content

Instantly share code, notes, and snippets.

@koen12344
Created November 29, 2021 11:08
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/8401e471fcb12391828276f7bc240a03 to your computer and use it in GitHub Desktop.
Save koen12344/8401e471fcb12391828276f7bc240a03 to your computer and use it in GitHub Desktop.
Rankmath description variable in Post to Google My Business plugin
<?php
class PGMBRankMathSEOVariables implements \PGMB\Placeholders\VariableInterface {
private $parent_id;
public function __construct($parent_id) {
$this->parent_id = $parent_id;
}
public function variables() {
return [
'%rank_math_description%' => get_post_meta($this->parent_id, 'rank_math_description', true),
];
}
}
add_action('mbp_placeholder_decorators', function($decorators, $parent_post_id, $location){
$rank_math_variables = new PGMBRankMathSEOVariables($parent_post_id);
$decorators[] = $rank_math_variables;
return $decorators;
}
,10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment