如何在Wordpress中删除媒体库中图像的固定链接(登录页面)? [英] How to delete the permalink (landing pages) of image in the media library in Wordpress?

查看:72
本文介绍了如何在Wordpress中删除媒体库中图像的固定链接(登录页面)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到在wordpress网站上上传的每个图片都会有一个单独的页面(该图片的永久链接)

I notice every image uploaded on wordpress website will have a separate page(a permalink to the image)

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

这不好,如何为每个图像删除这些页面? 每个图像都有CDN链接.

This is not good, how do I remove these page for every image? Every image have already CDN link.

我保留了使用Yost plugin上传到博客文章的图片,但这些图片已上传到页面&没有附加到特定页面.这些图像在搜索结果中看起来不太好.

I have got hold on images uploaded for blog post using Yost plugin but these images are uploaded to pages & are not attached to the particular page. These images are not looking good on the search result.

请帮助我如何将其从wordpress中删除.

Please help me how can I remove this from wordpress.

推荐答案

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

Create a new file called image.php in your theme. Insert the code below in your image.php file,

<?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;
}

这篇关于如何在Wordpress中删除媒体库中图像的固定链接(登录页面)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆