[wp-hackers] Bug? wp_update_term and filter pre_update_term

Seamus Leahy seamus at moronicbajebus.com
Tue Sep 9 16:04:17 GMT 2008


Checking to see if this is a bug.

When using the function wp_update_term, it results in an error because $args
is not an array for array_merge. Obviously I am passing in an array, the
filter pre_update_term is run on $args before array_merge which makes $args
into the term id. I was able to fix this in my code by creating a dummy
filter which returns the $args instead of the post id:

function dummy_put($term, $taxonomy, $args ) {
    return $args;
}
add_filter( 'pre_update_term', 'dummy_put', 10, 3 );

Is it expected that plugin authors will know to create the dummy filter,
does the dummy filter need to be a WP default, or do plugin authors need to
avoid wp_update_term altogether?

wp_update_term:
http://trac.wordpress.org/browser/trunk/wp-includes/taxonomy.php#L1474

Seamus.


More information about the wp-hackers mailing list