Skip to content

Commit

Permalink
Merge pull request #233 from globeandmail/fix/232
Browse files Browse the repository at this point in the history
SIT-3134: fix/232: Updated data type of keywords field to array.
  • Loading branch information
jeffpaul authored Apr 14, 2022
2 parents 301d1df + 47fbb18 commit 0527343
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions includes/functions/content-sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function get_post_data( $post ) {
$content = apply_filters( 'the_content', get_the_content( null, false, $post ) );
$content = str_replace( ']]>', ']]>', $content );
$canonical_url = wp_get_canonical_url( $post );
$keywords = '';
$keywords = [];
$permalink = get_permalink( $post );

// Support Yoast SEO canonical URL and focus keyphrase.
Expand All @@ -198,7 +198,11 @@ function get_post_data( $post ) {
$canonical_url = $yoast_canonical;
}

$keywords = get_post_meta( $post->ID, '_yoast_wpseo_focuskw', true );
$yoast_focuskw = get_post_meta( $post->ID, '_yoast_wpseo_focuskw', true );
if ( ! empty( $yoast_focuskw ) ) {
// Limit focus keyphrase to max length of 128.
$keywords = [ substr( $yoast_focuskw, 0, 128 ) ];
}
}

$parsed_url = wp_parse_url( $permalink );
Expand Down

0 comments on commit 0527343

Please sign in to comment.