WordPress.org

Make WordPress Core

Opened 8 years ago

Last modified 5 months ago

#18448 assigned defect (bug)

wp_insert_category() is Not Properly Abstracted

Reported by: miqrogroove Owned by: chriscct7
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Taxonomy Keywords: needs-testing has-patch needs-refresh
Focuses: Cc:
PR Number:

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 8 years ago.
Replaces wp_insert_category with wp_insert_term/wp_update_term accordingly

Download all attachments as: .zip

Change History (8)

#1 @miqrogroove
8 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
8 years ago

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

#3 @SergeyBiryukov
8 years ago

  • Keywords needs-patch added

@Dvvarf
8 years ago

Replaces wp_insert_category with wp_insert_term/wp_update_term accordingly

#4 @Dvvarf
8 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
6 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
5 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
4 years ago

  • Owner set to chriscct7
  • Status changed from new to assigned
Note: See TracTickets for help on using tickets.