Skip to content

Instantly share code, notes, and snippets.

@DavidCramer
Created December 30, 2016 09:21
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save DavidCramer/fa880a92f6f76b978e01ccbf2b039f8d to your computer and use it in GitHub Desktop.
Trigger an event on specific URL
<?php
// add this to your functions.php in your child theme
add_action( 'the_post', 'trigger_my_page_view' );
function trigger_my_page_view(){
// check if is single to avoid archive
if( is_single() && 'https://mydomain/path/' == get_the_permalink() ){
do_action( 'trigger_slack_event' ); // can be anything you feel like.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment