Skip to content

Commit

Permalink
title placeholders
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime Vanmeerbeck committed Nov 27, 2017
1 parent fa18355 commit 2fd5a47
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,15 @@ function wp_api_encode_yoast( $post, $field_name, $request ) {
$this->keys[] = 'yoast_wpseo_primary_' . $taxonomy;
}

$frontend = WPSEO_Frontend::get_instance();
$object = get_post($post['id']);

foreach ($this->keys as $key) {
$yoastMeta[$key] = get_post_meta($post['id'], '_' . $key, true);
if ('yoast_wpseo_title' === $key) {
$yoastMeta[$key] = $frontend->get_content_title($object);
} else {
$yoastMeta[$key] = get_post_meta($post['id'], '_' . $key, true);
}
}

return (array) $yoastMeta;
Expand Down

0 comments on commit 2fd5a47

Please sign in to comment.