如何删除 Wordpress 媒体库中图像的永久链接(登陆页面)?

How to delete the permalink (landing pages) of image in the media library in Wordpress?

我注意到上传到 wordpress 网站的每张图片都会有一个单独的页面(图片的 permalink)

像这样:https://www.knexusgroup.com/linkedin_logo_v1/

这不太好,如何为每张图片删除这些页面? 每个图片都已经有 CDN link.

我已使用 Yost plugin 保留为博客 post 上传的图片,但这些图片已上传到页面并且未附加到特定页面。这些图片在搜索结果中看起来不太好。

请帮助我如何从 wordpress 中删除它。

在您的主题中创建一个名为 image.php 的新文件。 在您的 image.php 文件中插入以下代码,

<?php
global $post;
if ( $post && $post->post_parent ) {
wp_redirect( esc_url( get_permalink( $post->post_parent ) ), 301 );
exit;
} else {
wp_redirect( esc_url( home_url( '/' ) ), 301 );
exit;
}