Last active
December 20, 2015 17:29
-
-
Save davekellam/6168835 to your computer and use it in GitHub Desktop.
WordPress Save Debugging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Save debug info to log | |
* | |
* @param int $post_id ID of the post to save | |
*/ | |
function dk_debug_save_post( $post_id ) { | |
global $wpdb; | |
error_log( print_r( $wpdb->queries, true ) ); | |
} | |
add_action( 'save_post', 'dk_debug_save_post' ); | |
/** | |
* Save wp_insert_post debug info to log | |
* | |
* @param int $post_id ID of the post to save | |
*/ | |
function dk_debug_insert_post( $post_id ) { | |
global $post; | |
error_log( print_r( $post, true ) ); | |
} | |
add_action( 'wp_insert_post', 'dk_debug_insert_post' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment