Code Block Encoding vs. Not Encoding Option

10/12/2018

If you’re wondering what the ‘Disable Code Block Encoding’ option found in Theme Options > Advanced tab does, please continue reading below.

What Happens To Your Content Inside A Code Block?

Essentially, any content within a Code Block element is encoded. This stops WordPress from getting it’s hands on the code and inserting <p> tags, line breaks and any other formatting changes that it likes to make to content inside the editor. By default, Avada takes the content and converts it into a base64 string so that it can be decoded when the page is rendered. This way it will come out on the page the same as it was inserted into the Code Block.

What Happens When You Enable The ‘Disable Code Block Encoding’ Option?

If you choose to enable the ‘Disable Code Blocking Encoding’ option located in Theme Options > Advanced, your Code Block elements essentially become a Text Block element and WordPress will have it’s way with the content inside. Please view below for a sample Google Analytics code inside a Code Block that has encoding enabled and disabled.

Encoding Disabled

If you have the ‘Disable Code Block Encoding’ option checked (Encoding Disabled), then WordPress will insert formatting changes. These tags alone are enough to break the JavaScript code. View screenshot here.

Encoding Enabled

If you have the ‘Disable Code Block Encoding’ option unchecked (Encoding Enabled), then your code will be inserted as intended and function correctly. View screenshot here.