How to Comment Out Code in WordPress

How to Comment Out Code in WordPress

Here is a basic tip for working with WordPress files. “Commenting out” code is a way making a section or block of code inactive. It can be handy, because there are times when you may want to temporarily comment code out but leave it in there so that you can use it later. It essentially hides the code until you remove the comment code.

Depending on what type of file you’re working in, there are different bits of code you’ll need to use. These examples are taken directly from the WordPress codex:

To comment out HTML:
{code type=php}

CSS file example:
{code type=css}/* .redblock {font-size: 80%; font-style: italic; color: red; } */

Within PHP tags:
{code type=php}
or
{code type=php}

This is a very basic skill that you will want to have under your belt when working with WordPress files. For more information about commenting code, please refer to the WordPress codex.

Free Video Why 100 is NOT a Perfect Google PageSpeed Score (*5 Min Watch) Learn how to use Google PageSpeed Insights to set realistic goals, improve site speed, and why aiming for a perfect 100 is the WRONG goal.
Tags: