WordPress.org

Make WordPress Core

Opened 6 weeks ago

Closed 9 hours ago

#41789 closed defect (bug) (fixed)

get_sites() returns an integer when 'count' is passed as a query var

Reported by: ocean90 Owned by: jeremyfelt
Milestone: 4.9 Priority: normal
Severity: normal Version:
Component: Networks and Sites Keywords: has-patch
Focuses: docs, multisite Cc:

Description

But the current @return tag only mentions an array.

Attachments (1)

41789.diff (1.8 KB) - added by jeremyfelt 9 hours ago.

Download all attachments as: .zip

Change History (13)

#1 @ocean90
6 weeks ago

  • Owner set to ocean90
  • Resolution set to fixed
  • Status changed from new to closed

In 41331:

Multisite: Clarify return type of get_sites() when 'count' is passed as a query var.

Fixes #41789.

#2 @johnbillion
6 weeks ago

In 41333:

Multisite: More specificity for the get_sites() documentation.

See #41789

#3 @ocean90
6 weeks ago

@johnbillion That specificity is incorrect. get_sites() can also return an array of IDs.
Also, why didn't you update get_sites()? And while we're on it, we should probably make the docs consistent across all the query classes.

#4 @johnbillion
6 weeks ago

  • Keywords needs-patch added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Let's try again.

This ticket was mentioned in Slack in #core-multisite by jeremyfelt. View the logs.


4 weeks ago

This ticket was mentioned in Slack in #core-multisite by flixos90. View the logs.


9 days ago

#7 @jeremyfelt
9 days ago

How about:

array|int Defaults to list of WP_Site objects. A list of site ids when 'fields' is set to 'ids'. The number of sites when 'count' is passed as a query var.

  • On WP_Site_Query's query() and get_sites() and in the get_sites() function.
  • Similarly with networks on WP_Network_Query's query() and get_networks() and in the get_networks() function.

This ticket was mentioned in Slack in #core-multisite by flixos90. View the logs.


8 days ago

This ticket was mentioned in Slack in #core by melchoyce. View the logs.


2 days ago

#10 @melchoyce
2 days ago

@johnbillion Still trying to get this one in 4.9?

@jeremyfelt
9 hours ago

#11 @jeremyfelt
9 hours ago

  • Keywords has-patch added; needs-patch removed
  • Owner changed from ocean90 to jeremyfelt
  • Status changed from reopened to reviewing

Let's go with 41789.diff for 4.9. We can address the documentation of other queries in another ticket.

#12 @jeremyfelt
9 hours ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 41912:

Multisite: Document all return types in get_sites().

Adds more complete documentation to get_sites() and the corresponding methods in WP_Site_Query.

Fixes #41789.

Note: See TracTickets for help on using tickets.