admin管理员组文章数量:1390399
I have a form I've developed that creates a WP_Query to search through a custom post type in Wordpress.
There are 4 fields: title, author, orderby(selectbox), order(selectbox)
Say the user types in "cats" in title and presses search, my URL will look like this:
?spot_title=cats&spot_author=&spot_orderby=date&spot_order=desc
I'd prefer to have the URL simply be
?spot_title=cat
Since the rest are the "default" values and/or blank. I'm not hooking this into JavaScript anywhere, but is that my only solution? I feel like WordPress would have a helper function for this somewhere.
The HTML for the form is a simple:
<form role="search" method="get" class="cpt-search-form" action="">
本文标签: wp queryWordpress custom search formignore emptydefault input fields upon submission
版权声明:本文标题:wp query - Wordpress custom search form - ignore emptydefault input fields upon submission? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744705267a2620805.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论