Created
December 22, 2023 18:12
-
-
Save tobeyadr/10953b5c5429b31a25fe9214e0a87396 to your computer and use it in GitHub Desktop.
An example of use the track_live_activity() function
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
<?php | |
add_action( 'favorites_post', 'track_activity_when_post_is_favorited' ); | |
/** | |
* Tracks activity in Groundhogg when a user marks their post as favorite | |
* | |
* @param $post WP_Post | |
* | |
* @return void | |
*/ | |
function track_activity_when_post_is_favorited( $post ) { | |
\Groundhogg\track_live_activity( 'favorite_post', [ | |
'post_id' => $post->ID | |
] ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment