save_post not working for Pages/CPTs
-
Ran into a problem this weekend, where my custom hook onto save_post action was not firing for pages, or custom post types. I’ve done some debugging this morning, and it seems that
save_post
is not firing at all for pages (and I would assume CPTs). I’ve deactivated all plugins and activated Twenty Fifteen, tried different variations of the hook (save_page
,save_post_page
), and the action does not fire. I’m using simple code to test:add_action('save_post','save_post_test'); function save_post_test($post_id) { exit('saving'); }
It does fire when saving a post, but not pages/CPTs. Is there something I’ve missed in 4.0.1?
Edit: it gets weirder: i just edited
wp-includes/post.php
toexit()
with output just before each (two)do_action('save_post')
, but still nothing! how is that possible?? script doesexit()
when placed at beginning ofwp_insert_post()
, so I’m going to work my way down through the function and see where it returns. ??
- The topic ‘save_post not working for Pages/CPTs’ is closed to new replies.