• Resolved tbare

    (@tbare)


    Is there a good way to hook into a function? I have some custom code I added to an older version, and I’d like to update the plugin, but don’t want to have to manually add my code after each update. Wondering if there’s a way I can add my own plugin that hooks in after the post_edit_entry” function, and where I can pass the original_entry_id.

    Any tips would be appreciated.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author fried_eggz

    (@fried_eggz)

    Good idea. I have added two actions, the first one fires after an entry has been edited and the second one after an entry has been deleted.

    do_action( 'entry_deleted', $entry )

    do_action( 'entry_edited', $old_entry, $new_entry )

    In your case you can use the second hook like so

    add_action('entry_edited','my_entry_edited_function', 10, 2 );
    function my_entry_edited_function($old_entry, $new_entry) {
        $original_entry_id = $old_entry['id']
    }
    • This reply was modified 8 years, 5 months ago by fried_eggz.
    • This reply was modified 8 years, 5 months ago by fried_eggz.
    Thread Starter tbare

    (@tbare)

    This is exactly what I needed. Thank you! Worked perfect.

    Plugin Author fried_eggz

    (@fried_eggz)

    No problems. Good feature request. If you like the plugin please consider writing a short review. Thank you.

    Plugin Author fried_eggz

    (@fried_eggz)

    Just an update @tbare. I’ve had to change the name of the hooks implemented due to possible naming collisions. Actions are now called:

    do_action( 'stickylist_entry_deleted', $entry )

    do_action( 'stickylist_entry_edited', $old_entry, $new_entry )

    Watch out for this if you update to 1.4.5+

    Thread Starter tbare

    (@tbare)

    Thanks for the heads up. Got my code fixed.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Hook into post_edit_entry function’ is closed to new replies.