Make WordPress Core

Opened 17 months ago

Last modified 14 months ago

#39301 new defect (bug)

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

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


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
17 months 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
14 months 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:


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

#4 @mcbsys
14 months 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
14 months ago


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
14 months ago

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