Make WordPress Core

Opened 4 years ago

Closed 7 months ago

Last modified 7 months ago

#52297 closed defect (bug) (invalid)

Custom WP types params - remove or fix to fix inconsistent typing

Reported by: malthert's profile malthert Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords:
Focuses: Cc:

Description

e.g.

 * @return string[]|WP_Taxonomy[] The names or objects of all taxonomies of `$object_type`.
 */
function get_object_taxonomies($object, $output = 'names')

Returns WP_Taxonomy type.
But functions that are commonly used with this, do not accept this type.
e.g.

 * @param string|string[] $taxonomies The taxonomy names to retrieve terms from.
 * @param array|string    $args       See WP_Term_Query::__construct() for supported arguments.
 * @return array|WP_Error The requested term data or empty array if no terms found.
 *                        WP_Error if any of the taxonomies don't exist.
 */
function wp_get_object_terms($object_ids, $taxonomies, $args = array())

$taxonomies does not accept WP_Taxonomy.

In general it's a bad idea to use these custom types like WP_Taxonomy. But if we use it, we must use it consistently, which is not the case currently

Change History (4)

#1 @sabernhardt
4 years ago

  • Component changed from General to Taxonomy

#2 @hellofromTonya
4 years ago

  • Version trunk deleted

#3 @malthert
7 months ago

  • Resolution set to invalid
  • Status changed from new to closed

#4 @swissspidy
7 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.