我添加了一個按鈕,我的搜索結果中排除的結果的特定類別(簡單地增加&cat=-22
到當前的URL)。從當前URL刪除特定查詢「&貓= -22」的WordPress relevanssi搜索結果
我想找出一種方法來添加另一個按鈕來從當前網址中「刪除」查詢(即http://host/?s=test&cat=-22
將最終成爲http://host/?s=test
)。
如果可能的話,需要指定的文本,只除去,因爲它是可能的查詢並不總是在URL的末尾,即可以
http://host/?s=test&cat=-22&orderby=post_modified&order=desc
或
http://host/?s=test&orderby=post_modified&order=desc&cat=-22
我試圖修改這裏和其他地方列出的幾種方法,但最終只刪除'貓',如果由於某種原因用戶在搜索特定類別時點擊鏈接,那麼最終只會刪除'貓',即
http://host/?s=test&orderby=post_modified&order=desc&cat=2
成爲
http://host/?s=test&orderby=post_modified&order=desc
點擊鏈接時。
希望有道理!
任何與此有關的幫助將非常感謝!
邁克
的[在一個URI查詢字符串替換值](http://stackoverflow.com/questions/3777481/replace-values-in-a-uri-query-string) – Gordon