Skip to content

Instantly share code, notes, and snippets.

@justinshreve
Created January 11, 2017 17:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save justinshreve/5bc9aad5a7ab36b0f74afaa52e11c340 to your computer and use it in GitHub Desktop.
Save justinshreve/5bc9aad5a7ab36b0f74afaa52e11c340 to your computer and use it in GitHub Desktop.
Displays a backtrace for deprecation notices.
<?php
/**
* Plugin Name: Deprecation Backtrace
* Description: Shows the line number and file where a deprecation notice occurs.
* Version: 1.0.0
* Author: WooCommerce
*/
// https://westi.wordpress.com/2012/01/28/tracing-things-back-to-where-they-came-from/
// https://westi.wordpress.com/2012/01/28/tracing-things-back-to-where-they-came-from/#comment-14182
function deprecation_notice_backtrace() {
error_log( wp_debug_backtrace_summary() );
}
add_action( 'doing_it_wrong_run', 'deprecation_notice_backtrace' );
add_action( 'deprecated_argument_run', 'deprecation_notice_backtrace' );
add_action( 'deprecated_function_run', 'deprecation_notice_backtrace' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment