Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Gist for my article Building a Gutenberg sidebar plugin Part 5: Outputting data
public function add_metatags_to_head() : void {
global $post;
foreach( $this->metafields as $key => $value ) {
if ( $key == 'title' ) {
$value = \trim( \get_post_meta( $post->ID , $value , true ) );
echo "\t<meta name=\"{$key}\" content=\"{$value}\" />\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment