Opened 15 years ago
Last modified 3 months ago
#18448 assigned defect (bug)
wp_insert_category() is Not Properly Abstracted
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| 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)
Change History (9)
#2
@
15 years ago
It gets used in a few spots, but I imagine it should be consolidated into wp_insert_term().
#4
@
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
@
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
@
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
#8
@
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.phpwp-admin/includes/taxonomy.php
Reject files were generated:
wp-includes/taxonomy.php.rejwp-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.
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?