[wp-hackers] Bug? wp_update_term and filter pre_update_term

Otto otto at ottodestruct.com
Tue Sep 9 16:37:34 GMT 2008


Err... What? I can't find a "pre_update_term" anywhere in the code,
and I see no filters being run on $args at all in the code that you're
pointing to.


On Tue, Sep 9, 2008 at 11:04 AM, Seamus Leahy <seamus at moronicbajebus.com> wrote:
> 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.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list