register_post_type permalink 时间:2017-11-14 作者:Djordje Maric 接下来,我有一个问题。我创建了一个post\\u类型=“gallery”。因此,当我打开我的图库时,我的链接如下:localhost/gallery_name/image_name 但我需要这样的结构:localhost/post_name/gallery_name/image_name 在我的function php\'rewrite\' => array(\'slug\' => \'/\',) 如何保存我的帖子名(我的永久链接结构),然后添加库名和图像名?非常感谢。 1 个回复 SO网友:Preetam Gawade 您必须使用post\\u type\\u链接筛选器。创建一个处理程序来处理这个过滤器,您可以根据需要在那里创建$permalink。除此之外,您可能还必须使用“pre\\u get\\u posts”操作。几个月前,我使用了这两种方法,创建了permalinks以显示为cpt\\U名称/post\\U名称。 结束 文章导航