Make WordPress Core

Opened 4 months ago

Last modified 4 months ago

#61242 new defect (bug)

PHP warning when `'taxonomies'` in `register_post_type` is set to `false` instead of `array()`

Reported by: siddiquesaad's profile siddiquesaad Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.5.3
Component: Posts, Post Types Keywords: has-patch
Focuses: Cc:

Description

It shows this warning everywhere.

Warning: Invalid argument supplied for foreach() in /public_html/wp-includes/class-wp-post-type.php on line 753

Change History (3)

This ticket was mentioned in PR #6570 on WordPress/wordpress-develop by @siddiquesaad.


4 months ago
#1

  • Keywords has-patch added

#2 @swissspidy
4 months ago

  • Component changed from General to Posts, Post Types
  • Focuses coding-standards php-compatibility removed

Why/How are you passing false there in the first place when it needs to be an array?

#3 @jrf
4 months ago

What @swissspidy said. Additionally, if this warning occurs, there must be a coding error somewhere, which is exactly what the warning is telling you about. Such warnings should never be hidden, as that hides useful information about a bug which needs to be fixed.

The bug should be fixed in the place where it originates, which can be found via a backtrace.

The current patch is definitely not the way to go.

Note: See TracTickets for help on using tickets.