1

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

2 Answers 2

-1

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

3

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.com/?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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.