Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.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
Wordpress 自定义帖子url?_Wordpress - Fatal编程技术网

Wordpress 自定义帖子url?

Wordpress 自定义帖子url?,wordpress,Wordpress,我制作了一个新的自定义帖子,如下所示: register_post_type( 'news', array( 'label' => __('News'), 'public' => true, 'show_ui' => true, 'show_in_nav_menus' => false, 'menu_position' =&

我制作了一个新的自定义帖子,如下所示:

register_post_type( 'news',
            array( 
            'label' => __('News'), 
            'public' => true, 
            'show_ui' => true,
            'show_in_nav_menus' => false,
            'menu_position' => 5,
            'rewrite' => false,
            'supports' => array(
                    'title',
                    'thumbnail',
                    'editor',
                    'excerpt')
                ) 
            );
但是,当我试图获取post url时,它如下所示
http://domainname.com/?news=post_title

我希望url是这样的
http://domainname.com/category/title

因此,我尝试了下面的帖子,将重写更改为
array('slug'=>title','with\u front'=>true)
但当我这样做,它给我404页找不到


这里出了什么问题?

是的,我知道出了什么问题 您必须首先将永久链接重置为默认值,然后使用
rewrite

然后返回到
/%category%/%postname%/

设置下的permalink结构设置如何/%category%/%postname%/您是否尝试切换到默认设置,然后再切换回/%category%/%postname%/是尝试过。。但同样的结果。。能不能用重写器做点什么让我很快给你测试一下