Make WordPress Core

Ticket #33721: wordpress-importer.php.2.diff

File wordpress-importer.php.2.diff, 1.3 KB (added by westonruter, 10 years ago)
  • wordpress-importer.php

     
    555555                        $post_type_object = get_post_type_object( $post['post_type'] );
    556556
    557557                        $post_exists = post_exists( $post['post_title'], '', $post['post_date'] );
     558
     559                        /**
     560                         * Filter ID of the existing post corresponding to post currently importing.
     561                         *
     562                         * Return 0 to force the post to be imported. Filter the ID to be something else
     563                         * to override which existing post is mapped to the imported post.
     564                         *
     565                         * @see post_exists()
     566                         * @since 0.6.2
     567                         *
     568                         * @param int   $post_exists  Post ID, or 0 if post did not exist.
     569                         * @param array $post         The post array to be inserted.
     570                         */
     571                        $post_exists = apply_filters( 'wp_import_existing_post', $post_exists, $post );
     572
    558573                        if ( $post_exists && get_post_type( $post_exists ) == $post['post_type'] ) {
    559574                                printf( __('%s “%s” already exists.', 'wordpress-importer'), $post_type_object->labels->singular_name, esc_html($post['post_title']) );
    560575                                echo '<br />';
    561576                                $comment_post_ID = $post_id = $post_exists;
     577                                $this->processed_posts[ intval( $post['post_id'] ) ] = intval( $post_exists );
    562578                        } else {
    563579                                $post_parent = (int) $post['post_parent'];
    564580                                if ( $post_parent ) {