Last active
August 25, 2019 16:47
-
-
Save damiencarbery/a9a21db76f61a53554c3ea2fee658638 to your computer and use it in GitHub Desktop.
HTML comments may not work for debugging - Debug comments may not appear in markup if the page is minified. https://www.damiencarbery.com/2019/08/html-comments-may-not-work-for-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 | |
/* | |
Plugin Name: Debug with comments | |
Plugin URI: https://www.damiencarbery.com/2019/08/html-comments-may-not-work-for-debugging/ | |
Description: Debug using html comments. | |
Author: Damien Carbery | |
Version: 0.1 | |
*/ | |
// This div *will* be removed during html minification. | |
add_action( 'wp_footer', 'dcwd_footer_debug_with_comments' ); | |
function dcwd_footer_debug_with_comments() { | |
echo '<!-- Page ID: ', get_the_id(), ' -->'; | |
} |
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
<p class="first-p">This is the first paragraph.</p><p class="last-p">This is the last paragraph.</p> |
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
<!-- Comment before the content --> | |
<p class="first-p">This is the first paragraph.</p> | |
<!-- A comment in the middle --> | |
<p class="last-p">This is the last paragraph.</p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment