WordPress.org

Support

Support » Plugins and Hacks » Hacks » action save_post not firing on create post

action save_post not firing on create post

  • save_post hook

    I’m writin a plugin which uses custom post types and I’ve added

    add_action('admin_init','ddb_custom_post_format_admin');
    
    function ddb_custom_post_format_admin() {
    add_action('save_post', 'ddb_save_data');

    ………

    then

    function ddb_save_data($post_id) {
    // try echoing to see what we have
    	echo 'ddb_save_data-post type=' . get_post_type();

    …….

    This works perfectly if I am editing but it doesn’t seem to fire at all when adding from the “Add new” menu item of the custom post type.
    The new post of custom post type saves and can be edited OK
    but how can I hook into the save_post of a new post?
    I want to hook into it straight after it has saved so I can do other processing.

    Am I adding the action in the right place?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘action save_post not firing on create post’ is closed to new replies.
Skip to toolbar