Categories
Tutorials

Make WordPress Images Non Clickable Inside a Post

When you upload an image inside your WordPress blog’s post, it becomes clickable. Let’s remove the link behind an image automatically so that, images inside the post doesn’t remain clickable anymore.

Why one needs this?

Have you ever heard about the word ENGAGMENT? Yes or No? Let me tell you when a visitor clicks an image inside your WordPress blog’s Post, that particular image shows up(With nothing else at that link) which makes the visitor close the tab and move away. What happens with that?

Why that bad?

  • You start loosing your visitors
  • Your site’s bounce rate increases
  • Avg time of per visit decreases.

How to tackle this problem?

Goto your WordPress blog’s Admin panel and move to Appearance Tab >> Then Editor >> After that select Functions.php from the right side bar. Add the following code at its end, and then click Update

 update_option( 'image_default_link_type', 'none' );
 function no_atag_on_images($content){
return preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $content); }
add_filter('the_content', 'no_atag_on_images');   

What this code will do?

It will remove a tag from every image you upload & include in the post. Like the image below has only img tag and no a tag.

no a tag

FAQ

What about my old posts?

They will remain unchanged.

How will I add link to an image if I intentionally want to add one?

This code will not stop you from adding links manually to a blog post’s image. But one thing you can stay sure of is it will  not allow automatic links to be included.

What if I want to add the image link to the image?

When you are about to insert the image in the post click File URL once :)

[ad1]

Your Turn:

  • Did you like the tutorial?
  • How much it affected your engagement?

By Freakify Editorial

The post was written by Freakify Team.

This blog used to be managed by Ahmad Awais before it was acquired.

I have had been designing web pages since the early days of tables & spacers. And No – I’ve never used the scrolling marquee with Comic Sans fonts . Well, I am an Entrepreneur who left his orthodox path of Electrical Eng after graduation to become a UX Engineer/Marketer & a Motivational Speaker. Read more about me at AhmadAwais.com

10 replies on “Make WordPress Images Non Clickable Inside a Post”

My bounce rate was around 79%, but after implementing what you you said, it decreased by 2.7%. It did make a difference, thanks for that man

Good solution for this…. Maybe it could seem a not important issue but can help a lot. I think the pictures on your post are great to put a inner link. What do you think?

Comments are closed.