I am in the process of putting together a WordPress website, with WooCommerce functionality.

At present, I have 2 copies of the website’s web files; a Local Copy and a Live Copy.

Local Copy

These files contain all the and Comments.

Live Copy

These files contain all the coding, minus the and Comments.

Is anyone aware whether I can create some kind of entry in the functions.php file, which will strip all of the comments before it is rendered in the browser?

I realise that some may suggest just placing all of the comments within the php tags but this is not always possible from an organisational perspective.

Read more here: Is it possible to strip php files of its comments via the functions.php file?


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: