{"action":"created","issue":{"url":"https://api.github.com/repos/woocommerce/woocommerce/issues/13800","repository_url":"https://api.github.com/repos/woocommerce/woocommerce","labels_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/13800/labels{/name}","comments_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/13800/comments","events_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/13800/events","html_url":"https://github.com/woocommerce/woocommerce/issues/13800","id":217612440,"number":13800,"title":"save_post fires twice when updating products","user":{"login":"leewillis77","id":1097338,"avatar_url":"https://avatars0.githubusercontent.com/u/1097338?v=3","gravatar_id":"","url":"https://api.github.com/users/leewillis77","html_url":"https://github.com/leewillis77","followers_url":"https://api.github.com/users/leewillis77/followers","following_url":"https://api.github.com/users/leewillis77/following{/other_user}","gists_url":"https://api.github.com/users/leewillis77/gists{/gist_id}","starred_url":"https://api.github.com/users/leewillis77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leewillis77/subscriptions","organizations_url":"https://api.github.com/users/leewillis77/orgs","repos_url":"https://api.github.com/users/leewillis77/repos","events_url":"https://api.github.com/users/leewillis77/events{/privacy}","received_events_url":"https://api.github.com/users/leewillis77/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-03-28T16:08:48Z","updated_at":"2017-04-11T07:53:23Z","closed_at":"2017-03-28T16:36:08Z","body":"## EXPLANATION OF THE ISSUE\r\n\r\nThe save_post hook fires twice when a product is updated on WooCommerce 3.0.0-rc.1. It only fires a single time on 2.6.14.\r\n\r\n## STEPS TO REPRODUCE THE ISSUE\r\n\r\nAttach to the save_post with your favourite debug output. Update a post, e.g.\r\n\r\n    add_action( 'save_post', function ( $post_id ) {\r\n        if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {\r\n            return;\r\n        }\r\n        error_log('save_post called!');\r\n    }\r\n\r\n## Expected output\r\n\r\nA single instance of \"save_post called!\" in the error log. This is what you get on 2.6.14.\r\n\r\n## Actual output\r\n\r\nTwo copies of \"save_post called!\" in the error log. "},"comment":{"url":"https://api.github.com/repos/woocommerce/woocommerce/issues/comments/293180005","html_url":"https://github.com/woocommerce/woocommerce/issues/13800#issuecomment-293180005","issue_url":"https://api.github.com/repos/woocommerce/woocommerce/issues/13800","id":293180005,"user":{"login":"ole1986","id":4850116,"avatar_url":"https://avatars0.githubusercontent.com/u/4850116?v=3","gravatar_id":"","url":"https://api.github.com/users/ole1986","html_url":"https://github.com/ole1986","followers_url":"https://api.github.com/users/ole1986/followers","following_url":"https://api.github.com/users/ole1986/following{/other_user}","gists_url":"https://api.github.com/users/ole1986/gists{/gist_id}","starred_url":"https://api.github.com/users/ole1986/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ole1986/subscriptions","organizations_url":"https://api.github.com/users/ole1986/orgs","repos_url":"https://api.github.com/users/ole1986/repos","events_url":"https://api.github.com/users/ole1986/events{/privacy}","received_events_url":"https://api.github.com/users/ole1986/received_events","type":"User","site_admin":false},"created_at":"2017-04-11T07:53:23Z","updated_at":"2017-04-11T07:53:23Z","body":"IMO this issue needs to be escalated?\r\n\r\nExample code below still causing an order or a product to fire the action twice.\r\n```\r\nadd_action('post_save', 'my_save_action');\r\nfunction my_save_action() {\r\n    if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;\r\n    if( ! ( wp_is_post_revision( $post_id) || wp_is_post_autosave( $post_id ) ) ) {\r\n        // STILL FIRES TWICE\r\n    }\r\n}\r\n```\r\n\r\n**Only workaround is to make use of `remove_action`**\r\n\r\nExample:\r\n\r\n`remove_action('post_save', 'my_save_action')`;"}}
{"actor":{"display_login":"ole1986"}}