Make WordPress Core

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#12482 closed defect (bug) (fixed)

Correction to wp_insert_term() documentation

Reported by: prettyboymp's profile prettyboymp Owned by: dd32's profile dd32
Milestone: 3.0 Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: has-patch
Focuses: Cc:

Description

After tracing through the code to see if I actually could use the wp_insert_term() method to add an existing term in a new taxonomy by it's id, I found that the method's documentation for its $term was incorrect in accepting an INT value for the $term parameter. It is cast as a string within the function so a term_id can't be passed in for this param as one would suspect given the docs.

Attachments (1)

12482.diff (710 bytes) - added by prettyboymp 15 years ago.

Download all attachments as: .zip

Change History (7)

@prettyboymp
15 years ago

#1 @nacin
15 years ago

  • Component changed from General to Inline Docs
  • Milestone changed from 3.1 to 3.0
  • Owner set to nacin

Inline docs remain fine for 3.0, in fact they are encouraged.

#2 @nacin
15 years ago

  • Component changed from Inline Docs to Taxonomy
  • Owner changed from nacin to filosofo

This also reveals some dead code in there:

if ( is_int($term) && 0 == $term )
	return new WP_Error('invalid_term_id', __('Invalid term ID'));

That should be removed if the rest of the function doesn't support term IDs.

#3 @filosofo
15 years ago

  • Owner changed from filosofo to nacin
  • Status changed from new to assigned

#4 @nacin
15 years ago

  • Owner changed from nacin to dd32

I'm going to pass this off to dd32 for a review. I think we're good to both fix the docs and remove the dead code.

#5 @ryan
15 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [14785]) Update phpdoc for wp_insert_term(). Props prettyboymp. fixes #12482

#6 @dd32
15 years ago

I'm going to pass this off to dd32 for a review.

And i've only just got to the wp-trac email to see this.

I remember seeing that same code and questioning what it did, But left it for lack of knowledge of what it did.. So your guess is as good as mine in this case.

Note: See TracTickets for help on using tickets.