I have registered a custom post type .On submission of that page/ post can i call a custom method . How ?
Can i add a method in plugin file and will it call on post type submission by ACF or any other way in the admin side?
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI have registered a custom post type .On submission of that page/ post can i call a custom method . How ?
Can i add a method in plugin file and will it call on post type submission by ACF or any other way in the admin side?
save_post is an action triggered whenever a post or page is created or updated, which could be from an import, post/page edit form, xmlrpc, or post by email. The data for the post is stored in $_POST, $_GET or the global $post_data, depending on how the post was edited. For example, quick edits use $_POST.
Since this action is triggered right after the post has been saved, you can easily access this post object by using get_post($post_id)
http://codex.wordpress.org/Plugin_API/Action_Reference/save_post