4

I'm hoping somebody could help me out with the following issue. I have a wordpress page: http://www.howdesign.com/design-jobs and there is a list of jobs coming from behance.net via JavaScript. When you click on "Next Page" or a specific page number, the URL is supposed to be as follows: /design-jobs/?callback=Joblist.search.repage&page=2&sort=published_date&status=current

However, WordPress automatically takes the "page=2" and rewrites the URL as

/design-jobs/2/?callback=Joblist.search.repage&sort=published_date&status=current

(I was unable to post more than two URLs hence the shortened version). Notice the number 2 is now out of the query string and "page=2" was removed as well. This then breaks the pagination of the job listing on this page.

I was wondering if there is a way to disable this rewrite behavior for a specific page to allow the pagination to work correctly.

1 Answer 1

2

The redirect_canonical filter is responsible for this, which you can selectively disable depending on the requested page. This is untested, but should work:

function wpa66273_disable_canonical_redirect( $query ) {
    if( 'design-jobs' == $query->query_vars['pagename'] )
        remove_filter( 'template_redirect', 'redirect_canonical' );
}
add_action( 'parse_query', 'wpa66273_disable_canonical_redirect' );
1
  • Looks like exactly what I needed. Thank you much for your prompt reply.
    – matr07
    Sep 26, 2012 at 15:23

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.