WordPress.org

Make WordPress Core

Opened 12 months ago

Last modified 11 months ago

#52297 new defect (bug)

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

Reported by: malthert Owned by:
Milestone: Awaiting Review 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 (2)

#1 @sabernhardt
12 months ago

  • Component changed from General to Taxonomy

#2 @hellofromTonya
11 months ago

  • Version trunk deleted
Note: See TracTickets for help on using tickets.