最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

url rewriting - Remove url parameter using wordpress

programmeradmin5浏览0评论

how can I remove a parameter from a URL in wordpress? for example if I have the following URL: /?cat=4&paged=2&order=DESC How can I remove paged from it?

how can I remove a parameter from a URL in wordpress? for example if I have the following URL: http://domain/?cat=4&paged=2&order=DESC How can I remove paged from it?

Share Improve this question asked Aug 23, 2012 at 16:02 Feras OdehFeras Odeh 4351 gold badge8 silver badges16 bronze badges
Add a comment  | 

2 Answers 2

Reset to default -1

You should use pretty permalink. Please read this docs from WordPress Codex for full information.

Using remove_query_arg() to remove query string from the URL.

For example, to remove the paged query string from the current page URL:

remove_query_arg('paged', false); //FALSE, means to use the current URL

If you have specific URL:

remove_query_arg('paged', 'http://domain/?cat=4&paged=2&order=DESC');

Or if you have multiple query string and you wanted to remove them:

$paramaters = array('cat', 'paged', 'order');
remove_query_arg($paramaters, false); //FALSE, means to use the current URL
发布评论

评论列表(0)

  1. 暂无评论