Skip to content
Advertisement

How to remove unused tags on my WordPress site?

I have the following site: https://www.daenischer-kerzenshop.de/ If i look at the source code via the browser, I can detect empty tags.

Does anyone happen to know why they are generated and how I can remove them? I have searched all possible files and removed all code that could possibly cause this.Unfortunately I could not find a usable plugin either.

Here is an example (Browser-> View source code-> line: 1465 ):

<div class="container section-title-container">
  <h1 class="section-title section-title-center">
    <b></b>
    <span class="section-title-main">Qualitätsmerkmale der Dänischen Kerzen</span>
    <b></b>
  </h1>
</div>

The site uses the theme Flatsome.

Any help would be greatly appreciated!

Advertisement

Answer

Using str_replace() Method

This is the simplest and the easiest method to exclude any unused tags or text. Just add the below code and see the magic.

$foo = '
<div class="container section-title-container">
  <h1 class="section-title section-title-center">
    <b></b>
    <span class="section-title-main">Qualitätsmerkmale der Dänischen Kerzen</span>
    <b></b>
  </h1>
</div>';

$bar = str_replace('<b></b>', '', $foo); // Magic mathod
echo $bar;

The Code After Cleaning Unused Tags

<div class="container section-title-container">
  <h1 class="section-title section-title-center">  
    <span class="section-title-main">Qualitätsmerkmale der Dänischen Kerzen</span>   
  </h1>
</div>
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement