• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » Remove WordPress Post Image Link (Image Link 404 Fix)

By Abhishek Ghosh October 1, 2014 8:06 am Updated on October 1, 2014

Remove WordPress Post Image Link (Image Link 404 Fix)

Advertisement

If you are getting lot of 404 and soft 404 in Google webmaster tools, you can add this snippet to remove WordPress Post image links to solve. There are many weblogs, question answer forums tried to provide a snippet which works for all Theme Frameworks – including Genesis, Thesis, Woo and practically all, but most either never works or stops working after a version update of WordPress. Our Snippet To Remove WordPress Post Image Link (Image Link 404 Fix) Will Work With Any Theme And Forever. This precisely works with Genesis.

 

Remove WordPress Post Image Link (Image Link 404 Fix) : Why and Advantages

 

This falls among best practice for good WordPress websites. Linking to own post or the image is actually meaningless and not informative. We only need the image src HTML output to insert the image. WordPress, unfortunately never provides an effective update with fixes bugs, issues of the old content – in other words, even if there is option to remove WordPress Post Image Link from the newer posts, there is no official way to remove the image links from older posts.

SQL Query is not a great way for full removal, as there can be need in future to get back to older condition within a snap. You should probably read Fix WordPress 404 Errors For Non Existing URLs to understand that – doing a 301 redirection towards the post or somewhere is not good to get rid off 404. Image, simply should not have any link unless you manually insert an image and then link it for definite reason.

Advertisement

---

Remove WordPress Post Image Link Image Link 404 Fix

 

Remove WordPress Post Image Link (Image Link 404 Fix) : The Snippet

 

You will need PHP prey replace function :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
// add to active theme's function.php file
// or child themes function.php file if exists
function google_image_link_void( $content ) {
    $content =
        preg_replace(
            array('{<a(.*?)(wp-att|wp-content\/uploads)[^>]*><img}',
                '{ wp-image-[0-9]*" /></a>}'),
            array('<img','" />'),
            $content
        );
    return $content;
}
add_filter( 'the_content', 'google_image_link_void' );

This snippet will not change anything at backend, you will see post image links while editing the old posts. But this actually filter outs the HTML output. As it runs before W3TC or any Cache Plugin Works, once you have added and checked it from fronted, purge the cache and then clear the Cache. Remove all the post image related 404 from Google Webmasters tool and you will not get the error anymore. Try to hover over this post’s image, there is no link. If we change the snippet in use, we will update the post. We are good consumer of this snippet!

This is a practical way – it will not harm any links on category thumbnail or other images. If you manually change the image class in a post for some reason, obviously you will get the hyperlink working. This does not work (WP Beginner) for current version of WordPress :

Vim
1
2
3
4
5
6
7
function wpb_imagelink_setup() {
    $image_set = get_option( 'image_default_link_type' );    
    if ($image_set !== 'none') {
        update_option('image_default_link_type', 'none');
    }
}
add_action('admin_init', 'wpb_imagelink_setup', 10);

Tagged With post links on post wordpress remove , wp page remove old image link
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Remove WordPress Post Image Link (Image Link 404 Fix)

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • WordPress & PHP : Different AdSense Units on Mobile Devices

    Here is How To Serve Different AdSense Units on Mobile Devices on WordPress With PHP. WordPress Has Function Which Can Be Used In Free Way.

  • 404 WordPress Plugins : Top 6 WordPress Plugins for 404 Error

    404 Wordpress Plugins are useful for 404 HTTP Errors. These 404 Wordpress Plugins which might give you some SEO benefit.

  • PHP Snippet to Hide AdSense Unit on WordPress 404 Page

    Here is Easy PHP Snippet to Hide AdSense Unit on WordPress 404 Page to Avoid Policy Violation and Decrease False Impression, False Low CTR.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Market Segmentation in BriefSeptember 20, 2023
  • What is Booting?September 18, 2023
  • What is ncurses?September 16, 2023
  • What is JTAG in Electronics?September 15, 2023
  • iPhone 15 Pro Max Vs Samsung Galaxy S22/S23 UltraSeptember 14, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy