12% off of LTD using this coupon: TWELVEPERCENTOFF. Promo ends on 2 Dec midnight UTC.
Published on Sep 10, 2019

How to Remove IDs from Oxygen

Sridhar Katakam

Update: The tutorial below or this plugin are not tested with the current version of Oxygen and as such try them at your own risk. For the most recent workarounds, check this link on GitHub.


In the WPDevDesign Facebook group a user asked:

I know it's possible to remove all id's in Oxygen with this js input;
$('body:not(.oxygen-builder-body) *').removeAttr('id');
But is it possible to change this so that all id's will be removed except all the id's with a prefix for example.
id="prefix-idname"
So if the id starts with prefix- or something else. These id's will not be removed.
Why I want this. I just want a clean html source, because usually we got empty id's and don't use it.

This members-only tutorial provides the steps to remove ID attributes and their values for all elements in the frontend except for elements whose ID values begin with keep- in Oxygen using jQuery.

We will also extend this to ensure that not only do the prefixed elements gets excluded from the id attribute removal but also, all their children.

Here's How

Edit the Main Catch All Template in Oxygen editor.

Add a Code Block below all other elements.

PHP & HTML:

<?php
	// echo "hello world!";
?>

JavaScript:

This is a premium members-only content.

To view the rest of the content, please sign up for membership ($47/month or $599 one-time).

Already a member? Log in below or here.

tagschevron-leftchevron-rightchainangle-rightangle-upangle-downfolder-ocalendar-check-omagnifiercrossmenuchevron-downarrow-right