How to Delete all Active Links in a Post

How to Delete all Active Links in the Post in Blogger
Snowxy.uk

I honestly don't understand why anyone will want to delete all the links in their blog post. If everything leads to the outside (external) it can still be understood, maybe so that visitors do not run away after clicking the link. But what about internal links? That's good for SEO.

Alright. Since this is a request, so I will still make the tutorial. Do you know the reason for wanting to deactivate the link? Please leave a comment.

Script to delete all URLs in the post

Before using this, make sure you have specific goals and understand the risks after disabling all active links. You just don't need to go along with it.

There are two versions, Javascript and jQuery. CHOOSE ONE, which is preferred. Can be used both on Blogger and Wordpress. Just adjust the name of the HTML element id or class.

Example: the class name is .post-body. If it turns out that in your Blogger or WordPress template it's different, just change to the name you use.

Javascript

  
    /* Remove All Links Inside Posts by snowxy.com */
(function ignielRemLinkPost(){
 if (document.querySelector('.post-body')){
  var a = document.querySelectorAll('.post-body a');
  for (var x = 0; x < a.length; x++){
   var b = a[x].text, c = a[x].parentNode, d = document.createElement('span'); d.innerHTML = b;
   a[x].remove();
   c.appendChild(d);
  }
 }
})();
  

jQuery

  
    /* Remove All Links Inside Posts by snowxy.com */
window.onload = (function ignielRemLinkPost(){
 if ($('.post-body')){
    $('.post-body').find('a').each(function(){
      $(this).contents().unwrap();
    })
 }
});
  
Done. If successful, all active URLs in the article content will disappear and change to plain text.

Read Also

Post a comment

-->