Add post synchronization functionality for Markdown files
- Implemented a parser for YAML front-matter in Markdown files. - Developed functions to convert Markdown content to HTML. - Created a pipeline to sync WordPress posts from a specified folder in a Git repository. - Added media import capabilities to handle images referenced in Markdown. - Implemented author resolution and post slug generation. - Included error handling and logging for sync operations. - Enabled trashing of posts that are no longer present in the repository.
This commit is contained in:
@@ -17,10 +17,12 @@ delete_option( 'oribi_sync_log' );
|
||||
delete_option( 'oribi_sync_webhook_secret' );
|
||||
delete_option( 'oribi_sync_theme_applied' );
|
||||
delete_option( 'oribi_sync_push_log' );
|
||||
delete_option( 'oribi_sync_posts_enabled' );
|
||||
delete_option( 'oribi_sync_posts_folder' );
|
||||
|
||||
// Remove sync metadata from posts
|
||||
// Remove sync metadata from pages and posts
|
||||
$posts = get_posts( [
|
||||
'post_type' => 'page',
|
||||
'post_type' => [ 'page', 'post' ],
|
||||
'post_status' => 'any',
|
||||
'posts_per_page' => -1,
|
||||
'meta_key' => '_oribi_sync_checksum',
|
||||
@@ -36,5 +38,17 @@ foreach ( $posts as $post_id ) {
|
||||
delete_post_meta( $post_id, '_oribi_sync_pr_url' );
|
||||
}
|
||||
|
||||
// Remove origin src meta from media attachments
|
||||
$attachments = get_posts( [
|
||||
'post_type' => 'attachment',
|
||||
'post_status' => 'any',
|
||||
'posts_per_page' => -1,
|
||||
'meta_key' => '_oribi_sync_origin_src',
|
||||
'fields' => 'ids',
|
||||
] );
|
||||
foreach ( $attachments as $att_id ) {
|
||||
delete_post_meta( $att_id, '_oribi_sync_origin_src' );
|
||||
}
|
||||
|
||||
// Clear any scheduled cron
|
||||
wp_clear_scheduled_hook( 'oribi_sync_cron_run' );
|
||||
|
||||
Reference in New Issue
Block a user