Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.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';创建自定义帖子类型后是否永久链接?_Wordpress_Custom Post Type_Permalinks - Fatal编程技术网

如何创建Wordpress';创建自定义帖子类型后是否永久链接?

如何创建Wordpress';创建自定义帖子类型后是否永久链接?,wordpress,custom-post-type,permalinks,Wordpress,Custom Post Type,Permalinks,我刚刚在Wordpress中创建了一个名为products的自定义帖子类型。当我选择普通永久链接时,链接工作正常。当我选择任何其他永久链接时,找不到URL 例如,http://localhost/TheGrind/?products=gopro-hero6 black是我的永久链接,选择了普通选项。和http://localhost/TheGrind/product/gopro-hero6-black/是我希望在帖子中使用的永久链接。我得到一份工作 Not Found The requ

我刚刚在Wordpress中创建了一个名为products的自定义帖子类型。当我选择普通永久链接时,链接工作正常。当我选择任何其他永久链接时,找不到URL

例如,
http://localhost/TheGrind/?products=gopro-hero6 black
是我的永久链接,选择了普通选项。和
http://localhost/TheGrind/product/gopro-hero6-black/
是我希望在帖子中使用的永久链接。我得到一份工作

 Not Found
    The requested URL /TheGrind/product/gopro-hero6-black/ was not found on this server.
问题是,当我在Wordpress中创建自定义帖子类型时,如何让这种类型的URL起作用

非常感谢您的帮助。

您可以尝试添加

flush_rewrite_rules();
你打过电话之后

register_post_type();
这在过去已经解决了我的问题

如果它确实适用于您,那么您可以删除“flush_rewrite_rules();”,因为WordPress指出这是一个昂贵的操作


只需再次保存permalink的新选项,即可刷新旧的重写规则。如何保存新选项?我试过刷新规则();但这不起作用。请检查此屏幕(permalinks)中是否存在.htaccess的任何错误消息,也许您应该检查您对此文件的权限。谢谢您的帮助。在Apache中修改了httpd.config文件后,我成功地使其工作。现在我所有的链接都像我预期的那样完美。问题是允许设置所有的覆盖。现在,当我在Wordpress中时,我可以为每个网站设置.htaccess文件。再次感谢!