[wp-hackers] Re: [wp-svn] [6271] trunk/wp-includes/taxonomy.php: Catch WP_Error.

Peter Westwood peter.westwood at ftwr.co.uk
Fri Oct 19 08:53:03 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

m at wordpress.org wrote:
> Revision
>     6271
> Author
>     ryan
> Date
>     2007-10-18 15:55:15 +0000 (Thu, 18 Oct 2007)
> 
> 
>       Log Message
> 
> Catch WP_Error. Props tellyworth. fixes #5226
> 
> 
>       Modified Paths
> 
>     * trunk/wp-includes/taxonomy.php <#trunkwpincludestaxonomyphp>
> 
> 
>       Diff
> 
> 
>         Modified: trunk/wp-includes/taxonomy.php (6270 => 6271)
> 
> 
> --- trunk/wp-includes/taxonomy.php	2007-10-17 21:20:45 UTC (rev 6270)
> +++ trunk/wp-includes/taxonomy.php	2007-10-18 15:55:15 UTC (rev 6271)
> @@ -1119,6 +1119,8 @@
>  	foreach ($terms as $term) {
>  		if ( !$id = is_term($term, $taxonomy) )
>  			$id = wp_insert_term($term, $taxonomy);
> +		if ( is_wp_error($id) )
> +			return $id;
>  		$term_ids[] = $id['term_id'];
>  		$id = $id['term_taxonomy_id'];
>  		$tt_ids[] = $id;
> 
> 

Shouldn't the check on is_wp_error() only be done inside this if:

if ( !$id = is_term($term, $taxonomy) )

is_term doesn't return a wp_error only wp_insert_term does?

westi
- --
Peter Westwood
http://blog.ftwr.co.uk
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHGHBvVPRdzag0AcURAimjAKDFnzDf6Ckvfm1/yKoTMFSUbcH3pwCeMLsq
78zAkb90al6wxtIMkGIzJM0=
=jgJc
-----END PGP SIGNATURE-----


More information about the wp-hackers mailing list