admin管理员组文章数量:1384622
I'm a webdev but have zero wordpress experience, and I'm helping a friend.
So I have permalinks to posts in this format:
/
However for some reason there are also links in this format that return content:
/
And the latter format returns a page with the same title, a single image, but none of the text. I'm not sure how and why these latter URLs are being created nor how to remove them. I'd like those URLs to redirect to the actual post (eg /
redirecting to /
).
Any idea how I might do this?
Here is a live example:
/
/
I'm a webdev but have zero wordpress experience, and I'm helping a friend.
So I have permalinks to posts in this format:
https://example/some-slug/
However for some reason there are also links in this format that return content:
https://example/some-slug/alternative-categoryA-categoryB-blog-1/
And the latter format returns a page with the same title, a single image, but none of the text. I'm not sure how and why these latter URLs are being created nor how to remove them. I'd like those URLs to redirect to the actual post (eg https://example/some-slug/alternative-categoryA-categoryB-blog-1/
redirecting to https://example/some-slug/
).
Any idea how I might do this?
Here is a live example:
https://lolawho/lola-loves-mike-parisellas-otherworldly-mixed-media-collages/
https://lolawho/lola-loves-mike-parisellas-otherworldly-mixed-media-collages/mike-parisella-lola-who-fashion-music-photography-blog-1/
1 Answer
Reset to default 0Those links are called Attachment pages, and Wordpress creates one for each media attachment in a post. There are a few plugins to disable them. To redirect the user to the actual post, one can add the following line of code:
// in wp-content/themes/[your-child-theme]/image.php
<?php wp_redirect(get_permalink($post->post_parent)) ; ?>
Link: https://www.greengeeks.ca/tutorials/article/set-wordpress-to-disable-attachment-pages-for-media/
本文标签: pluginsAdded slug after URL permalink last slash returns different content
版权声明:本文标题:plugins - Added slug after URL permalink last slash returns different content 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744490673a2608713.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论