Tag: debug

  • WordPress debug code

    WordPress debug code

    WordPress debug 代码,把它放在function 文件里,就会在每页的页脚出现这个,包括当前模板,重写规则,Query 等等。 add_action( ‘template_include’, ‘_childtheme_print_template_name’ ); function _childtheme_print_template_name( $template_name ) { global $childtheme_template_name; $childtheme_template_name = $template_name; add_action( ‘wp_footer’, ‘childtheme_print_template_name’, 100 ); return $template_name; } function childtheme_print_template_name( ) { global $childtheme_template_name, $wp_query, $wp_options; echo ” <div style=’padding-left:50px’> DEBUG INFO: Active Template: “.$childtheme_template_name.”\n”; childtheme_print_matched_rewrite_rule(); echo ‘posts_per_page (default option) = ‘.get_option( ‘posts_per_page’ ).”\n”; echo “\n\nWP_QUERY:…