Skip to content

Commit

Permalink
Override post_title with meta title if it not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
bafi committed Aug 28, 2024
1 parent d1bcdad commit c0b214e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/PccSyncManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ private function createOrUpdatePost($postId, Article $article, bool $isDraft = f
$data['post_excerpt'] = $article->metadata['description'];
}

// Set post title if available.
if (isset($article->metadata['title']) && $article->metadata['title']) {
$data['post_title'] = $article->metadata['title'];
}

if (!$postId) {
$postId = wp_insert_post($data);
update_post_meta($postId, PCC_CONTENT_META_KEY, $article->id);
Expand Down

0 comments on commit c0b214e

Please sign in to comment.