I have added my own custom post type continent using register_post_type and have created the template single-continent.php. The page is accessed via /moving-to/continent-name.

        'capability_type'   => 'post',
        'edit_item'         => __('Edit Continent'),
        'has_archive'       => false,
        'labels'            => array(
            'add_new_item'  => __('Add new Continent'),
            'edit_item'     => __('Edit Continent'),
            'name'          => __('Continents'),
            'singular_name' => __('Continent')
        'menu_icon'         => 'dashicons-location-alt',
        'public'            => true,
        'rewrite'           => array('slug' => 'moving-to'),
        'show_in_nav_menus' => true,
        'supports'          => array('editor', 'thumbnail', 'title')

Regular posts can reference this continent (using the ACF Pro plugin) and I am pulling these posts into the page using a second WP_Query loop. All working fine so far.

My problem is that I cannot get pagination to work. I would like to be able to use /moving-to/continent-name/page/2 to display more posts. I am checking for get_query_var('paged') but cannot seem to call the URL using /page/2 or ?paged=2.


1 Answer 1


You need to set up query for pagination, look at this example :

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

$args = array(
    'post__in' => $ids,
    'post_type' => 'product',
    'paged' => $paged,
    'posts_per_page' => 15);

  • The query works fine (I can manually set the $paged variable), but I cannot get the URL /page/2 to work, so $paged is always 1. Jan 27, 2017 at 11:30

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.