I’m still learning php and have run up against what should be a relatively easy problem to fix but I’m stuck so any help appreciated 🙂
I have a WordPress site which is using a plugin that I don’t want to disable.
I’m trying to get all code on the index page validated at w3c and have managed to do so, all apart from one line.
The plugin in is using some javascript to inject some code that is failing validation:
<link rel='stylesheet' id='flags/tpw_flags_css-css' href='http://www.xxx.xxx/wp-content/plugins/transposh-translation-filter-for-wordpress/widgets/flags/tpw_flags_css.css?ver=0.8.2' type='text/css' media='all' />
The validation error occurs with “id=’flags/tpw_flags_css-css'” as it contains a back-slash.
I think in all honesty the id can be removed completely.
I’ve tried removing from the javascript with no success, so thought I might be able to do with a $html string replace but no joy there either.
I’ve tried putting various options both in header.php and footer.php before the html content starts and at the end after html closes but no joy:
<?php $html = str_replace("id='flags/tpw_flags_css-css'", "", $html); ?>
I’ve heard of preg_replace but still novice with PHP.
Any ideas to the correct solution for this much appreciated
Regards Tony
Put this before anything is output in your header.php file:
Put this in your functions.php file: