[wp-trac] [WordPress Trac] #40042: Empty Author ID on first time action pre_get_post is called.
WordPress Trac
noreply at wordpress.org
Mon Mar 6 10:28:45 UTC 2017
#40042: Empty Author ID on first time action pre_get_post is called.
--------------------------+-----------------------------
Reporter: BackuPs | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 4.7.2
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Hi
I want to set pagination for authors by grabbing a field which is attached
to the user record. But the first time the action is called in
pre_get_posts $query only has a username. And that is the only moment one
can set the $query->set( 'posts_per_page', XXXX ); where XXX is the amount
set for that user.
So i can only do this hardcoded. But i want to be able to call the user
meta by its id and set the amount of posts by that setting.
[[Image(http://i.imgur.com/2IaFTeC.png)]]
How to work around this? Why is the author ID not set and only the name?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40042>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list