Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/258.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在WordPress中从URL中删除自定义分类库_Php_Wordpress - Fatal编程技术网

Php 如何在WordPress中从URL中删除自定义分类库

Php 如何在WordPress中从URL中删除自定义分类库,php,wordpress,Php,Wordpress,请帮我用wordpress 我想从wordpress中的URL中删除自定义文本库 http://domainname/travel-category/beaches to http://domainname/beaches http://domainname/travel-category/beaches 到 http://domainname/beaches 其中“旅行类别”是自定义注册分类基础,“海滩”是类别 我的代码是: register_taxonomy(

请帮我用wordpress

我想从wordpress中的URL中删除自定义文本库

http://domainname/travel-category/beaches to http://domainname/beaches http://domainname/travel-category/beaches 到 http://domainname/beaches 其中“旅行类别”是自定义注册分类基础,“海滩”是类别

我的代码是:

register_taxonomy( 'travel-category', //taxonomy base 'destination', // custom post type ... ); 注册与分类( “旅行类别”,//分类库 '目的地',//自定义帖子类型 ... );
做一件事,为
register\u taxonomy
函数的
rewrite
参数添加以下代码:

'rewrite' => array( 'slug'  => '/',  'with_front' => FALSE ),

希望这能起作用,如果没有,请尝试刷新永久链接页面。

这会中断页面/发布url。这会修复分类url,但会在网站上每隔一页404。这对我很有效,谢谢。上下文:使用2个CPT(在其register\u post\u type()args数组中具有类似的重写数组)构建网站。目标:具有类似//和//的url(注意不要让CPT1和CPT2帖子名称冲突。