Remove class from body tag in wordpress
- Log in to your WordPress admin dashboard.
- Navigate to "Appearance" in the left sidebar and select "Theme Editor."
- Locate and click on the "functions.php" file in the right-hand column.
- Insert the following code at the end of the "functions.php" file:
function remove_body_class($classes) {
// Replace 'your-class-to-remove' with the class you want to remove
$classes = array_diff($classes, array('your-class-to-remove'));
return $classes;
}
add_filter('body_class', 'remove_body_class');
- Replace 'your-class-to-remove' with the actual class you want to remove.
- Click the "Update File" button to save the changes.
Note: Editing theme files directly can be risky. Ensure you have a backup of your website before making any changes. If you're not comfortable with code, consider using a child theme or a custom CSS plugin for a safer approach.