This post will help you to learn how you can remove any class from WordPress Body And Post Classes that you don’t want any more from different files like template specific or functions file.

Remove Any Class From WordPress Body And Post Classes

You can use the snippets mentioned below directly in either template file that uses WordPress Template hierarchy or the main functions.php file if you intend to use a simple if a condition.

If you want to use the front-page.php template on pages like archives or anywhere else in the same theme then this trick is your best shot and you would not need to remove or modify existing CSS that gets generated by the template file.

Remove any class updating template file:

Add this code into template file to remove your desired class (Please replace your class name with CLASS_NAME):

Pretty simple, right? Please let us know if you face any issues.

Remove any class via functions file:

If you want to use functions.php file then you will have to add one more condition to the above code, we have attached one more code snippet below that you can use to remove archive class but make sure you update the if condition if you want to remove a different class.

We hope these code snippets help you to remove unwanted classes from your template pages, please let us know if you need any help in the comment section below.