Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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