Last active
November 12, 2020 22:03
-
-
Save tobeyadr/b98508a7fce52e1c73e6ec3caaa2ba35 to your computer and use it in GitHub Desktop.
Post creation hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'wp_insert_post', 'gh_new_post_hook' ); | |
function gh_new_post_hook(){ | |
if ( ! is_user_logged_in() ){ | |
return; | |
} | |
$contact = \Groundhogg\get_current_contact(); | |
if ( ! $contact ){ | |
return; | |
} | |
$contact->add_tag( 'Published Post' ); | |
$contact->update_meta( 'custom_meta_key', 'Custom Meta Value' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment