Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#13957 closed defect (bug) (wontfix)

Check for $wp_rewrite in register_taxonomy and register_post_type

Reported by: nacin's profile 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 14 years ago.

Download all attachments as: .zip

Change History (6)

@nacin
14 years ago

#1 @nacin
14 years ago

  • Keywords has-patch added

#2 @filosofo
14 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?

#3 @nacin
14 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.

#4 @dd32
14 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..

#5 @nacin
14 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.