How to Remove All Active Links in Posts

Script To Deactivate Links In Posts

To be honest, I don't understand why anyone would want to delete all the links in a blog article. If everything leads to the outside (externally) it is still understandable, maybe so that visitors don't run away after clicking the link. But what about internal links? That's good for SEO.

Yasudalah. Since this is a request, I will keep making the tutorial. Do you know the reason he wanted to disable the link? Please provide a comment.

Script to Delete All URLs in Posts

Before using this, make sure you have a specific goal and understand the risks after disabling all active links. If you just join in, don't bother.

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

Example: the class name is .post-body. If you find that your Blogger or WordPress template is different, just change the name you use.

/* Remove All Links Inside Posts by igniel.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);
  }
 }
})();

/* Remove All Links Inside Posts by igniel.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 turn into plain text. If you want a clear, safe and clear purpose, just use the delete link script in the Blogger comment content and the delete link script in the author's name in Blogger comments .

About My name is Nguyen Manh Cuong. I was born in a poor village in Ba Vi district, HA NOI province - windy and sunny land. Currently. https://blog.cydiaguide.app/. Mr Cuong.
Newer Posts Newer Posts Older Posts Older Posts

Comments

Post a Comment