WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#13957 closed defect (bug) (wontfix)

Check for $wp_rewrite in register_taxonomy and register_post_type

Reported by: nacin Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Taxonomy Keywords: has-patch
Focuses: Cc:

Description

I'm noticing some people report errors like this:

Fatal error: Call to a member function add_rewrite_tag() on a non-object in
/wp-includes/taxonomy.php on line 289

This plugin didn't work right in 2.9, but in 2.9 we checked $wp_rewrite for !empty() in register_taxonomy before calling add_rewrite_tag().

I suggest we add back those sanity checks.

Attachments (1)

13957.diff (1.1 KB) - added by nacin 5 years ago.

Download all attachments as: .zip

Change History (6)

@nacin5 years ago

comment:1 @nacin5 years ago

  • Keywords has-patch added

comment:2 @filosofo5 years ago

Since this is an issue of plugin or theme developers calling register_taxonomy at the wrong point, isn't it better to throw the fatal error to warn them away from it, rather than failing silently?

comment:3 @nacin5 years ago

Probably. That's actually why I recall I didn't raise this before.

I see that as fine for register_post_type(), but perhaps register_taxonomy() should be restored to its old state? We're breaking a lot of plugins I imagine.

comment:4 @dd325 years ago

IMO, the plugins need to be updated.

As it stands, They'll not be operating correctly at present with the code in that location, calling register_taxonomy() too early will result in non-existant rewrite links..

comment:5 @nacin5 years ago

  • Milestone 3.0.1 deleted
  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.