Skip to content

Instantly share code, notes, and snippets.

@pimpmywp
Last active April 1, 2016 15:58
Show Gist options
  • Save pimpmywp/4483030 to your computer and use it in GitHub Desktop.
Save pimpmywp/4483030 to your computer and use it in GitHub Desktop.
[WordPress] インクルードされたテーマ関連ファイルをDebug Bar(Extender)の Variable Lookup で確認できるようにする。 ※テーマのフッターで wp_footer(); していること。
<?php
add_action( 'wp_footer', 'pm_trace_included_files' );
function pm_trace_included_files() {
$includeds = array_values(
str_replace(
get_theme_root()
, ""
, array_filter(
get_included_files()
, create_function( '$f', 'return 0 === strpos( $f, get_theme_root() );' )
)
)
);
if ( class_exists( 'Debug_Bar_Extender' ) )
Debug_Bar_Extender::instance()->trace_var( $includeds, 'Included Files' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment