[resolved] delete_post - order changed in newer WP? (3 posts)

  1. adebaby
    Posted 5 years ago #

    I have a plugin which does this kind of operation below and it seems like the meta is deleted before the add_action is called

    Has anyone else noticed this? Used to be fine before

    add_action('delete_post', 'onDeletePost');
    function onDeletePost($postid) {
    $custom = get_post_custom($postid);
    //do something with $custom;
    return $postid;

  2. adebaby
    Posted 5 years ago #

    Found the answer, new actions in WP 3.2 -

    "Rename duplicate 'delete_post' and 'deleted_post' actions to 'before_delete_post' and 'after_delete_post'"

    delete_post presumably defaults to after_delete_post. Would be better if the default was before_delete_post

  3. kg69design
    Posted 4 years ago #

    Thanks for a solution! Very helpful.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.