Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.