Skip to content

Pagination error #294

@rjorel

Description

@rjorel

Hey,

For some unknown reason, sermon pagination stopped working a few months ago.
To fix the issue on my website, I've removed

'add_args' => $add_args,

from paginate_links() here :

$add_args = array();
foreach (
array(
's',
'p',
'post_type',
'page_id',
) as $query_var_name
) {
$query_var = get_query_var( $query_var_name );
if ( $query_var ) {
$add_args[ $query_var_name ] = $query_var;
}
}
echo paginate_links( array(
'base' => preg_replace( '/\/\?.*/', '', rtrim( get_permalink( $post_ID ), '/' ) ) . '/%_%',
'current' => $query->get( 'paged' ),
'total' => $query->max_num_pages,
'end_size' => 3,
'add_args' => $add_args,
) );

I guess it comes from a WP (and/or my theme) updates, because post_type query variable is added to pagination links, while it are is present in query URL.

For example, I get links of the form /predications/?post_type[0]=post&post_type[1]=page&post_type[2]=e-landing-page

I checked the reason of this add_args in Git history, so I guess it's important to keep it, but for now it leads to a bug. Should you consider removing it for a future release?

Regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions