WordPress.org

Ready to get started?Download WordPress

Forums

Perform action 'delete_attachment' before DB-update (4 posts)

  1. stephanreiter
    Member
    Posted 5 years ago #

    Currently, the action 'delete_attachment' is performed after all data associated with the attachment in question has been removed from the database. It is therefore not possible to query custom attachment metadata in the action handler, which I would require for additional cleanup steps in a plugin.

    Is there any reason why it is not possible to perform 'delete_attachment' before the database is updated? Because, honestly, the current setup doesn't make a lot of sense to me, i.e. 'delete_attachment' handlers receive the post-id of the deleted attachment, which is, however, no longer valid and therefore useless.

    Thanks,
    Stephan

  2. Austin Matzko
    Member
    Posted 5 years ago #

    I created a ticket here.

  3. Austin Matzko
    Member
    Posted 5 years ago #

    And it has now been committed, so it will appear in WordPress 2.8.

  4. stephanreiter
    Member
    Posted 5 years ago #

    Awesome, thank you!

Topic Closed

This topic has been closed to new replies.

About this Topic