Skip to content

Instantly share code, notes, and snippets.

@davisshaver
Created July 21, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davisshaver/53d77898a7554c19be65 to your computer and use it in GitHub Desktop.
Save davisshaver/53d77898a7554c19be65 to your computer and use it in GitHub Desktop.
Speed Bumps – Example code to accompany http://fus.in/1MidK1N
<?php
add_filter( 'speed_bumps_rickroll_constraints', 'give_you_up', 10, 4 );
function give_you_up( $can_insert, $context, $args, $already_inserted ) {
if ( ! preg_match( '/give [^ ]+ up/i', $context['prev_paragraph'] ) ) {
$can_insert = false;
}
return $can_insert;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment