【发布时间】:2021-01-10 18:14:56
【问题描述】:
在我的 WordPress v5.5.1 中,我有自定义帖子“歌曲”。 我在所有页面的标题中都有以下搜索表单:
<form>
<input type="hidden" value="song" name="post_type" id="post_type" />
<input type="text" name="s" id="search" value="<?php the_search_query(); ?>">
</form>
搜索结果显示在search.php。
搜索表单适用于除自定义 post_type 页面www.example.com/song/song-1 之外的所有页面,搜索查询转到未找到的 404 页面。
【问题讨论】:
-
没有。我的问题是带有
<input type="hidden" value="song" name="post_type" id="post_type" />的搜索表单可以在整个网站上使用;它不仅适用于自定义 post_typesong单页。