Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination error #294

Open
rjorel opened this issue Jan 29, 2022 · 0 comments
Open

Pagination error #294

rjorel opened this issue Jan 29, 2022 · 0 comments

Comments

@rjorel
Copy link

rjorel commented Jan 29, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant