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

Potential issue with the getting current page var #10

Open
rmorse opened this issue Nov 16, 2016 · 0 comments
Open

Potential issue with the getting current page var #10

rmorse opened this issue Nov 16, 2016 · 0 comments

Comments

@rmorse
Copy link

rmorse commented Nov 16, 2016

Hi there,

Just reporting an issue and providing potential fix, I don't have enough time to pull req but would be great if you could include.

Background - I have a plugin that creates custom queries, and one of our users wanted to integrate the results from the query our plugin generates with your pagination.

I took a quick look and I've noticed you have the option to pass in custom_query which looks great and should work, however looking at the code I do see a potential error - on line 26:

$page = intval( get_query_var( 'paged' ) );

You get the current page variable using get_query_var, this function only accesses the global $wp_query so it can in fact (under certain circumstances) be incorrect - as is the case with our plugin.

Something I figured out is that you can get the paged variable directly from the query -

$page = $args['custom_query']->query['paged'];

which I think would cover all use cases.

Anyway would be great to get that change integrated, let me know what you think!

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