[wp-hackers] wp_delete_term inconsistence use of action hooks

Lox lox.dev at knc.nc
Mon Jun 20 00:47:34 UTC 2011


Ignore that request. The get_metadata() function properly returns the
metadata of a deleted term in the delete_term hook. Another plugin conflict
made me think that.

2011/6/20 Lox <lox.dev at knc.nc>

> Hello,
>
> I am working on a plugin that stores images and thumbnails for any term
> from any configured taxonomy.
>
> I make use of the wordpress metadata API to store informations about the
> terms images and their thumbnails in a meta_termmeta table.
>
> The problem comes when deleting a term. When a term get deleted, I need to
> delete the its image and thumbnails.
> The action hook I use is delete_term, action hook fired in wp_delete_meta
> function.
>
> Here is what I do in my delete_term function:
>
> - I select the term's image/thumbnails informations using wp_get_metadata
> function
> - I then loop through the thumbnails informations and I delete those
> - I finally delete the metadata using wp_delete_metadata function
>
> My problem here is that when the delete_term action get fired, the term is
> already deleted from the database, so the wp_get_metadata function don't
> return the term metadata that I need before deleting it.
>
> There is no pre_delete_term action, there is no delete_term / deleted_term
> actions hook scheme, and definitely no action hook before the term is
> deleted.
>
> Any thought on how I can handle this?
>
> --
> Lox
> lox.dev at knc.nc
>



-- 
Lox
lox.dev at knc.nc


More information about the wp-hackers mailing list