[wp-hackers] Odd wp_insert_post hook behavior MU 2.9.1.1
Elizabeth Buckwalter
elizabeth at slatetechpdx.com
Thu Apr 1 00:45:17 UTC 2010
In my plugin:
----------
public function process_article_submit($action = '') {
// building up post
echo "inserting ";
$sf = wp_insert_post($post);
echo $sf;
}
public function cache_activity_post($pid, $post) {
error_log(' uuuuuuh '. print_r($pid, true));
//....
}
add_action( 'wp_insert_post', array(&$fu, 'cache_activity_post') );
In post.php:
----------
echo '<pre>';print_r($post);echo '</pre>';
do_action('save_post', $post_ID, $post);
do_action('wp_insert_post', $post_ID, $post);
output:
----------
inserting
stdClass Object
(
[ID] => 931
[post_author] => 10
[post_date] => 2010-03-31 17:25:17
[post_date_gmt] => 0000-00-00 00:00:00
[post_content] => blah blah blah
[post_title] => Master Page File
[post_excerpt] =>
[post_status] => pending
[comment_status] => open
[ping_status] => open
[post_password] =>
[post_name] =>
[to_ping] =>
[pinged] =>
[post_modified] => 2010-03-31 17:25:17
[post_modified_gmt] => 0000-00-00 00:00:00
[post_content_filtered] =>
[post_parent] => 0
[guid] =>
[menu_order] => 0
[post_type] => post
[post_mime_type] =>
[comment_count] => 0
[ancestors] => Array
(
)
[filter] => raw
)
931
The post inserts as expected, but the hook does not run. However, the hook
is run upon delete, and apparently, doesn't pass $post.
error.log
------------
[Wed Mar 31 17:27:44 2010] [error] PHP Warning: Missing argument 2 for
FrontUsers::cache_activity_post() in /path/to/myclass.php on line 454,
referer: http://mydomain.com/wp-admin/edit.php
[Wed Mar 31 17:27:44 2010] [error] uuuuuuh 932, referer:
http://mydomain.com/wp-admin/edit.php
[Wed Mar 31 17:27:44 2010] [error] PHP Warning: Missing argument 2 for
FrontUsers::cache_activity_post() in /path/to/myclass.php on line 454,
referer: http://mydomain.com/wp-admin/edit.php
[Wed Mar 31 17:27:44 2010] [error] uuuuuuh 931, referer:
http://mydomain.com/wp-admin/edit.php
[Wed Mar 31 17:27:44 2010] [error] PHP Warning: Missing argument 2 for
FrontUsers::cache_activity_post() in /path/to/myclass.php on line 454,
referer: http://mydomain.com/wp-admin/edit.php
[Wed Mar 31 17:27:44 2010] [error] uuuuuuh 933, referer:
http://mydomain.com/wp-admin/edit.php
[Wed Mar 31 17:27:44 2010] [error] PHP Warning: Missing argument 2 for
FrontUsers::cache_activity_post() in /path/to/myclass.php on line 454,
referer: http://mydomain.com/wp-admin/edit.php
[Wed Mar 31 17:27:44 2010] [error] uuuuuuh 930, referer:
http://mydomain.com/wp-admin/edit.php
Any help would be appreciated.
Thanks,
Elizabeth Buckwalter
More information about the wp-hackers
mailing list