Make WordPress Core

Opened 15 years ago

Last modified 3 months ago

#18448 assigned defect (bug)

wp_insert_category() is Not Properly Abstracted

Reported by: miqrogroove's profile miqrogroove Owned by: chriscct7's profile chriscct7
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Taxonomy Keywords: has-patch needs-refresh
Focuses: Cc:

Description

If you look in http://core.trac.wordpress.org/browser/trunk/wp-admin/includes/taxonomy.php there is still a note that says "The 'taxonomy' key was added in 3.0.0."

However, this function calls category_exists() and cat_is_ancestor_of(), which never recognized the taxonomy argument.

Attachments (1)

18448.patch.diff (6.7 KB) - added by Dvvarf 15 years ago.
Replaces wp_insert_category with wp_insert_term/wp_update_term accordingly

Download all attachments as: .zip

Change History (9)

#1 @miqrogroove
15 years ago

Perhaps more to the point, in edit-tags.php function wp_insert_term() is called rather than wp_insert_category(). It may have been the original intention to deprecate wp_insert_category() in favor of the proper logic. Is this function still being used in core?

#2 @nacin
15 years ago

It gets used in a few spots, but I imagine it should be consolidated into wp_insert_term().

#3 @SergeyBiryukov
15 years ago

  • Keywords needs-patch added

@Dvvarf
15 years ago

Replaces wp_insert_category with wp_insert_term/wp_update_term accordingly

#4 @Dvvarf
15 years ago

  • Keywords needs-testing has-patch added; needs-patch removed

The patch replaces all calls to wp_insert_category with calls to corresponding term functions. wp_insert_category, however, had $wp_error argument, that was used to suppress returning WP_Error, so I added it to wp_insert_term and wp_update_term functions. Any opinions on this approach?
P.S. First patch. =)

#5 @wonderboymusic
13 years ago

  • Keywords needs-refresh added

The patch has a lot of bizarre whitespace - please refresh with the WP Coding Standards in mind

#6 @wonderboymusic
12 years ago

  • Milestone changed from Awaiting Review to Future Release

We do some replacing of the *_category() functions to use *_term() functions in the past couple of releases - needs to be refreshed and reviewed

#7 @chriscct7
10 years ago

  • Owner set to chriscct7
  • Status changed from new to assigned

#8 @huzaifaalmesbah
3 months ago

  • Keywords needs-testing removed

I attempted to test the attached patch against trunk (7.0-alpha-61215-src) using: 8448.patch.diff

The patch did not apply cleanly.

The following files had failed hunks:

  • wp-includes/taxonomy.php
  • wp-admin/includes/taxonomy.php

Reject files were generated:

  • wp-includes/taxonomy.php.rej
  • wp-admin/includes/taxonomy.php.rej

Given that this patch is very old and taxonomy-related code has changed significantly over time, the patch appears to be outdated and would need to be refreshed against current trunk before meaningful testing can be performed.

Since the patch cannot currently be tested against trunk, I have removed the needs-testing keyword.

This ticket already has needs-refresh, and a refreshed patch would be required before further testing or review can continue.

Note: See TracTickets for help on using tickets.