0

I'm using the following code on a WP3.9 site to show a bunch of custom post types with pagination on a static page set as the frontpage:

$args = array(
    'post_type' => 'movie'
);
$paged = (get_query_var('page')) ? get_query_var('page') : 1;
$wp_query = new WP_Query( array_merge( $args, array('paged' => $paged) ) );

The first page is showing the correct info, but when I go to domain.com/page/n/ I get redirected to domain.com.

If I add the following code to the functions.php file:

function disable_redirect_canonical( $redirect_url ) {
    $redirect_url = false;
    return $redirect_url;
}
add_filter('redirect_canonical','disable_redirect_canonical');

Then I can go to /page/3/ and greater, but /page/2/ still redirects to the main page.

I'm really lost about this and I'm not really sure where to look to fix this problem.

Any help would be appreciated

0

The culprit was the All in One SEO Pack plugin I'm using on the site. I had to disable the "Enable Advanced Options" in the "Custom Post Type Settings" section.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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