Support » Plugins » Hacks » save_post and wp_insert_post don't pass $post argument

  • Resolved tsimion


    Hi there,

    I’m working on a plugin with custom post_type.

    I’ve added a hook for the ‘save_post’ action so I can process the extra meta data required by my post_type:

    add_action('save_post', array('myObj', 'on_save_post'));

    and the function is:

    class myObj {
     function on_save_post($post_ID, $post)
      // process here

    However, the second argument ($post) doesn’t get passed when I ‘Publish’ the post.
    In fact I get a PHP Warning message:
    Warning: Missing argument 2 for myObj::on_save_post in <file> on line <line_no>

    the action call inside wp_insert_post() is
    do_action('save_post', $post_ID, $post);

    What am I doing wrong?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘save_post and wp_insert_post don't pass $post argument’ is closed to new replies.