【问题标题】:Detect post type attachment in WordPress检测 WordPress 中的帖子类型附件
【发布时间】:2018-10-30 09:07:46
【问题描述】:

在我的网站https://chicken-device.ir,在我更改帖子的永久链接后,我有很多找不到页面。

许多未找到的页面是图片页面。我写了一些代码来重定向 url 链接,例如https://example.com/post-namehttps://example.com/blog/post-name

现在我有很多附件文件,然后在谷歌网站管理员工具中返回 404 页面。 如何检测 WordPress 中的帖子类型附件?仅定位附件文件页面。

【问题讨论】:

    标签: wordpress attachment


    【解决方案1】:

    发布重定向网址的代码。 您可以使用此代码检查帖子类型:

    $queried_object = get_queried_object();
    $post_type = $queried_object->post_type;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-10-22
      • 2023-03-22
      • 1970-01-01
      • 2012-07-30
      • 1970-01-01
      • 1970-01-01
      • 2013-03-18
      • 2022-01-19
      相关资源
      最近更新 更多