[PHP유지보수]워드프레스에서 이미지 링크를 자동을 제거하는 방법

  • 2023.12.29 05:24:41
  • kimhi65@0c7d
blog
WordPress makes it super easy for you to upload images and create image galleries. However, one really annoying part about adding images to WordPress posts is that it automatically links the image to the media file. You can uncheck this option when adding an image, but sometimes you simply forget to uncheck it. In this article we will show you how to automatically remove default image links in WordPress.
[separator headline="h3" title="왜 워드프레스 이미지 링크를 제거해야 하는가 ?"]
By default, WordPress links images to themselves. A user sees that the image is a link, clicks it and they are then taken to the image file. From this page the user has two options: click the ‘back’ button in their browser or move on to another site. Usually it is the latter. It also affects your image SEO traffic because search engines could redirect users to the link used for the image instead of your post. Overall, it creates bad user experience and affects your site’s bounce rate.
One solution is that you simply select the option disable the link each time, but it is not feasible because sometimes you simply forget.
Removing default image link option in WordPress
default-image-link
[separator headline="h3" title="워드프레스 이미지 링크를 제거하기."]
It is very simple to disable the default image linking behavior in WordPress. All you have to do is add this code snippet in your theme’s functions.php file or in a site-specific plugin.
[cc lang="php"]
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);
[/cc]
Another way to do this is by installing and activating No Image Link plugin. It works out of the box and there are no options to configure. However, the plugin runs the option on every page, so it is better to simply add the code on your own.
Hopefully this will make adding images in WordPress a little less annoying specially if you never link to images. Do you link to image files on your site? Let us know by leaving a comment below.

댓글쓰기