Make WordPress Core

Opened 8 years ago

Last modified 8 years ago

#39301 new defect (bug)

Importer associates all posts with uncategorized term in WP4.7 PHP7

Reported by: staymanhou's profile staymanhou Owned by:
Milestone: WordPress.org Priority: normal
Severity: normal Version: 4.7
Component: Import Keywords:
Focuses: Cc:

Description

The WordPress Importer plugin fails to remove the uncategorized term from the post which has at least one category set. It's a pretty quick fix, though.

wordpress-importer.php after line 729
Insert:

if ( 'category' == $term['domain'] )
        $post_is_categorized = TRUE;

wordpress-importer.php after line 753
Insert:

if ( isset( $post_is_categorized ) && $post_is_categorized ) {
        wp_remove_object_terms( $post_id, 'uncategorized', 'category' );
        unset( $post_is_categorized );
}

And BTW, is there somewhere I can make pull requests for WP like on github? That will make it much easier to suggest code changes.

Change History (6)

#1 @dhanendran
8 years ago

Hi @staymanhou ,

You can find here the process of reporting the issue and you can find here the process for creating patch.

Once the patch is been updated to the ticket, Wordpress core committers and the Developers around the world will check the patch and discuss about it. Once the issue and patch validated, core committers will commit this change to the Wordpress SVN repo.

Hope this helps.

#2 @mcbsys
8 years ago

@staymanhou, I just hit this Category bug too. Thanks for the suggested fix. I found another bug (21007) referenced this Github repository, which seems to be owned by WordPress core committer boonebgorges:

https://github.com/boonebgorges/wordpress-importer

I found it pretty easy to submit a Pull Request for my other issue there.

#4 @mcbsys
8 years ago

@lukecavanagh Reviewing your edits Github, it looks like both edits were inserted above where @staymanhou suggested.

The first edit almost certainly needs to go after $term['domain'] is set, i.e. after line 729.

The second edit is suggested after line 753. You've got it inside the foreach instead of after the unset( $post['terms'], $terms_to_set );.

Also, not that familiar with Github processes but this pull request says shows up under "Replace use of wp_get_http()". Shouldn't it be separate?

#5 @lukecavanagh
8 years ago

@mcbsys

I will fix now on my fork.

My changes still show in the previous pull request.
https://github.com/boonebgorges/wordpress-importer/pull/5

#6 @ocean90
8 years ago

  • Focuses administration removed
  • Milestone changed from Awaiting Review to WordPress.org
Note: See TracTickets for help on using tickets.