post_updated hook missing arguments
-
Hi there.
I am currently working on some additional functionality for my theme. This requires a function to be called when a post is updated. For this, I found the post_updated hook in post.php:
do_action( 'post_updated', $post_ID, $post_after, $post_before);
I attached my own function to this hook like so:add_action('post_updated', 'clubtheme_post_updated'); function clubtheme_post_updated($post_id, $post_after, $post_before) { // Do something useful }
Pretty straightforward stuff, not much that can go wrong.
At least, that’s what I thought. It turns out that only $post_id gets passed to my function. The rest of the arguments are simply NULL. Likewise, PHP produces the following warnings:
[Mon Jul 26 20:22:47 2010] [error] [client ::1] PHP Warning: Missing argument 2 for clubtheme_post_updated() in /home/kipmans/dev/web/elephant/eboh/eboh_theme/includes/clubtheme-admin-hooks.php on line 30, referer: https://localhost.localdomain/wordpress3/wp-admin/post.php?post=30&action=edit&message=1 [Mon Jul 26 20:22:47 2010] [error] [client ::1] PHP Warning: Missing argument 3 for clubtheme_post_updated() in /home/kipmans/dev/web/elephant/eboh/eboh_theme/includes/clubtheme-admin-hooks.php on line 30, referer: https://localhost.localdomain/wordpress3/wp-admin/post.php?post=30&action=edit&message=1
I have checked the values of $post_before and $post_after just before the call to do_action() and they are fine. Only somehow, they don’t get passed on to my function.
How is this possible and what should I do to get things working?
PS. I just noticed the new coding subforum, maybe it would be more appropriate to move this thread to over there.
- The topic ‘post_updated hook missing arguments’ is closed to new replies.