/blog/%postname%/,这个新的自定义文章类型的固定链接是/blog/new-post-type。我不想从网站的固定链接设置中删除/blog/,因为我们在博客文章中使用它。如何将/blog/从新的文章类型中删除,使其像WordPress默认页面的固定链接一样,即www.website.com/name-of-page/? Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
register_post_type()函数的rewrite参数有一个with_front参数,当设置为false时,不会在固定链接结构中加上前缀。register_post_type( 'cpt', array( 'rewrite' => array( 'with_front' => false, ) );上述代码将阻止CPT的帖子URL中出现
/blog/,但我不知道那是否意味着URL将在根目录下工作。