Add force pull functionality and improve post content handling

This commit is contained in:
Matt Batchelder
2026-02-23 19:35:33 -05:00
parent 3b51382797
commit cdf176e224
5 changed files with 165 additions and 23 deletions

View File

@@ -386,9 +386,18 @@ function oribi_sync_push_page( int $post_id, array $opts = [] ): array {
}
// ── Generate content ──────────────────────────────────────────────────
$slug = $post->post_name;
$title = $post->post_title;
$wp_content = $post->post_content;
$slug = $post->post_name;
$title = $post->post_title;
// Read post_content directly from the DB — bypassing every get_post()
// filter — so we get exactly what oribi_sync_save_post() wrote.
global $wpdb;
$wp_content = (string) $wpdb->get_var(
$wpdb->prepare( 'SELECT post_content FROM ' . $wpdb->posts . ' WHERE ID = %d', $post_id )
);
// Clean any corruption baked in by previous syncs (e.g. \u0026amp; artefacts)
$wp_content = oribi_sync_clean_block_content( $wp_content );
$commit_msg = $opts['message'] ?? "Sync: update {$slug} from WordPress";