Skip to content

Instantly share code, notes, and snippets.

@lithiumlab
Last active February 15, 2019 15:26
Show Gist options
  • Save lithiumlab/e0cc432c100b8c5e96647d3cc9be3082 to your computer and use it in GitHub Desktop.
Save lithiumlab/e0cc432c100b8c5e96647d3cc9be3082 to your computer and use it in GitHub Desktop.
WP Write Log
<?php $post_type = get_post_type_object( get_post_type( get_the_ID()) );
echo $post_type->labels->singular_name ; ?>
<?php
if ( ! function_exists('write_log')) {
function write_log ( $log ) {
if ( is_array( $log ) || is_object( $log ) ) {
error_log( print_r( $log, true ) );
} else {
error_log( $log );
}
}
}
<?php
/*
Prevent the email sending step for specific form
*/
add_action("wpcf7_before_send_mail", "wpcf7_do_something_else");
function wpcf7_do_something_else($cf7) {
// get the contact form object
$wpcf = WPCF7_ContactForm::get_current();
// if you wanna check the ID of the Form $wpcf->id
if (/*Perform check here*/) {
// If you want to skip mailing the data, you can do it...
$wpcf->skip_mail = true;
}
return $wpcf;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment