I created a custom post type called wasb_contact
which can be inserted and edited both from the backend and from the frontend (through a form I created).
The CPT has some custom meta fields which are saved by a function called wasb_contact_save_postdata
and invoked by the save_post_{$post->post_type}
hook. I would like this function to be invoked only when the CPT is created or modified from the backend and not also when it is created or modified from the frontend.
How can I do?
if ( defined( 'WP_ADMIN' ) )
? But this all depends on how you've set up the front end form I suppose.