How to list custom post types on a custom post type page?

It seems like you need to override the canonical redirection on custom post types to get the pagination to work. It had nothing to do with the custom query used and described above, as that worked perfectly fine on a normal page and now also on a custom post type.

I figured out that I could use the following in my functions file:

/**
* Prevents custom post type pages from being redirected on pagination
*
* @param $url   - root URL
*/

if (! function_exists('disable_redirect_canonical') ) :

    function disable_redirect_canonical($url) {

        $accepted = array('listing');

        if (is_paged() && is_singular() && in_array(get_post_type(), $accepted)) { $url = false; }

    return $url; 
}
endif;
add_filter('redirect_canonical', 'disable_redirect_canonical');

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)