Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress: <body class="customize-support">

Quite simple, I want to remove customize-support class from <body>. I'm searching for a while now, can't find where it's been generated.

I want to embed content from one site to another using Ajax Include Script(Dynamic Drive) and CORS, so I need to replace <body> and its CSS with something else, otherwise it messes with site's CSS, they merge together.

When I replace <body> with <abody> it creates another <body>, level above, with only "customize-support" class.

Maybe there's another solution? Method above was the only one I could come up with.

like image 284
Armands L. Avatar asked Mar 23 '13 17:03

Armands L.


1 Answers

I spent a while trying to find this, and ideally solve it with overriding a hook or something, but no luck.

In wp-includes/theme.php, there's a function at the end of the file named "wp_customize_support_script", and it was introduced in WP 3.4.0.

If you look in that function, you'll see inline Javascript adding the class name. More specifically, the last line of the JS, so:

b[c] += ( window.postMessage && request ? ' ' : ' no-' ) + cs;

You could comment that out if the class really bothers you, but I'd recommend against editing WP core files. Because it's inline JS, I've yet to find a way to really alter it (without editing core, ofc). Hopefully a more elegant solution will turn up, but until then, I'll just use jQuery to remove the class and save my sanity.

Note that this class is only added when you are signed into the backend, and your user has the capability to edit themes.

EDIT--

If you remove the admin bar on the front end, the class won't be added. So for example, in my functions.php, I have:

// Removing front end admin bar because it's ugly
add_filter('show_admin_bar', '__return_false');

Cheers!

like image 105
Kaitlyn McDonald Avatar answered Sep 21 '22 11:09

Kaitlyn McDonald