Skip to content

Instantly share code, notes, and snippets.

@DavidCramer

DavidCramer/functions.php Secret

Created Dec 30, 2016
Embed
What would you like to do?
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
You can’t perform that action at this time.