Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added post format sync #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions wds-multisite-aggregate.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ function do_post_sync( $post_id, $post ) {

$post->tags_input = implode( ', ', wp_get_post_tags( $post_id, array( 'fields' => 'names', ) ) );

// Get post format for setting it after sync
$post->post_format = get_post_format( $post_id );

global $wpdb;
$post_blog_id = $wpdb->blogid;
$post->guid = "{$post_blog_id}.{$post_id}";
Expand Down Expand Up @@ -416,6 +419,9 @@ function do_post_sync( $post_id, $post ) {
$post_id = wp_insert_post( $post, true );

if ( ! is_wp_error( $post_id ) ) {
// Set post format of inserted post, WP sets standard post format on missing theme format support
set_post_format( $post_id, $post->post_format );

// do meta sync action
do_action( 'wds_multisite_aggregate_post_sync', $post_id, $post, $this->meta_to_sync );
$this->imported[] = $post;
Expand Down