【问题标题】:How can i remove slug in custome post type url?如何删除自定义帖子类型网址中的 slug?
【发布时间】:2012-08-27 07:07:34
【问题描述】:

在 Woothemes 的列表主题中,孩子是 Bookclub。 当我添加一本书时 - 作为自定义帖子类型 - 网址如下:

mysite/book/post-name

我试图删除蛞蝓“书”,但我失败了 我希望它是

mysite/post-name

【问题讨论】:

    标签: wordpress url wordpress-theming slug permalinks


    【解决方案1】:

    比为此安装一个完整的插件要好得多。
    用 4.3 测试:

    register_post_type( 'dummy', array(
        //other custom posttype definitions 
        'rewrite' => array('slug' => '/')
    ) );
    

    在此之后保存您的重写规则以使其工作。

    【讨论】:

    • 这比安装整个插件干净多了,谢谢。
    【解决方案2】:

    其实很简单,安装插件“Remove slug from custom post type”来删除'/product/' slug,不需要设置。安装插件“SEO Ultimate”以删除“产品类别”slug,在“Permalink Tweaker”下的 SEO Ultimate 设置中检查“产品类别”并保存。我们将其用于关联公司,因此无法对购物车等其他区域发表评论。

    【讨论】:

      【解决方案3】:

      我不知道这个插件的效果如何,但你去吧。

      http://wordpress.org/extend/plugins/remove-slug-from-custom-post-type/

      【讨论】:

        猜你喜欢
        • 2020-02-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-02-23
        • 2015-02-16
        • 2015-10-31
        • 2017-01-31
        • 2021-08-21
        相关资源
        最近更新 更多