Skip to content

Instantly share code, notes, and snippets.

@al5dy
Created March 19, 2016 07:25
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 al5dy/42f3965035d867183b57 to your computer and use it in GitHub Desktop.
Save al5dy/42f3965035d867183b57 to your computer and use it in GitHub Desktop.
Add custom [_admin_mail] shortcode to CF7
if ( ! function_exists( 'add_cf7_shortcode' ) ) {
add_filter('wpcf7_special_mail_tags', 'add_cf7_shortcode', 20, 3);
function add_cf7_shortcode($output, $name, $html) {
$name = preg_replace('/^wpcf7\./', '_', $name);
if ('_admin_mail' == $name) {
if ( function_exists('get_option_tree') ) {
$email = ot_get_option('email'); // get OT value
$output = $email;
}
}
return $output;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment