Opened 7 years ago
Last modified 7 years ago
#41819 assigned enhancement
Support the paged argument in WP_Site_Query and WP_Network_Query
Reported by: | birgire | Owned by: | spacedmonkey |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | 4.6 |
Component: | Query | Keywords: | has-patch has-unit-tests dev-feedback |
Focuses: | multisite | Cc: |
Description
The WP_Site_Query
and WP_Network_Query
both support the offset
and number
arguments.
It would be handy to be able to use the paged
argument, to make the pagination easier.
Attachments (3)
Change History (8)
#1
@
7 years ago
- Keywords has-patch has-unit-tests added
The patch adds the support for the paged
argument in WP_Site_Query
and WP_Network_Query
.
It's similar to the approach in #38268, for the WP_Comment_Query
, but I took a different approach in the tests. I tried to re-use the setup in:
Tests_Multisite_Site_Query::wpSetUpBeforeClass()
andTests_Multisite_Network_Query::wpSetUpBeforeClass()
,
using get_site_by()
and get_network_by()
to fix the test objects for the test queries. I will have to look better into that, if that's ok.
This patch also takes care of paged
as 0, to avoid a negative start value in the LIMIT clause.
When it's 0 it's treated as the default value of 1.
This ticket was mentioned in Slack in #core-multisite by birgire. View the logs.
7 years ago
This ticket was mentioned in Slack in #core-multisite by desrosj. View the logs.
7 years ago
#4
@
7 years ago
- Keywords dev-feedback added
- Milestone changed from Awaiting Review to Future Release
- Owner set to spacedmonkey
- Status changed from new to assigned
Assigning to @spacedmonkey to shepherd.
After discussing this in today's ticket scrub, it was decided this is a good thing to add. It could help with Networks and Sites in the REST API, and adds parity to the other query classes in core. Will not make it into 4.9
, but 5.0
is realistic.
Support for 'paged' argument in WP_Site_Query and WP_Network_Query, with tests.