WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#9644 closed defect (bug) (fixed)

(bug) get_categories

Reported by: arena Owned by: ryan
Milestone: 2.8.1 Priority: high
Severity: critical Version: 2.8
Component: Taxonomy Keywords: has-patch
Focuses: Cc:

Description

$args = array('hierarchical' => false,'depth'=>false,'echo'=>false,'get'=>'all');
$categories = get_categories($args);

returns

Array ( [errors] => Array ( [invalid_taxonomy] => Array ( [0] => Invalid Taxonomy ) ) [error_data] => Array ( ) )


Attachments (2)

9644.diff (1.2 KB) - added by ryan 7 years ago.
9644.2.diff (519 bytes) - added by Denis-de-Bernardy 7 years ago.

Download all attachments as: .zip

Change History (19)

#1 @mtekk
7 years ago

  • Resolution set to worksforme
  • Severity changed from critical to major
  • Status changed from new to closed

Works for me in r11082

#2 @arena
7 years ago

  • Resolution worksforme deleted
  • Status changed from closed to reopened

ryan

i do not see why this bug is related to "Check if not exists and not is_dir before bailing. Props st3ff3n."

#3 @DD32
7 years ago

  • Resolution set to worksforme
  • Status changed from reopened to closed

I believe mtekk's post was that as of revision 11082, Its working as expected under trunk.

It works for me under current trunk.

Given the error message, I'd assume theres a plugin conflict; Or theres a corrupt file.

Trac is not for diagnosing individual problems, You're better off on the support forums, and re-opening this if you find any info which suggests it IS a bug in WP(Such as also occuring on a fresh WP Install without any modifications)

#4 @DD32
7 years ago

  • Milestone 2.8 deleted

#5 @michaelh
7 years ago

  • Resolution worksforme deleted
  • Status changed from closed to reopened

Reopening this based on forum reports:
http://wordpress.org/support/topic/280256

#6 @michaelh
7 years ago

  • Milestone set to 2.8.1

Same issue as #10160??

Seems a number of themes with a theme options page that uses get_categories fail

http://wordpress.org/tags/trac9644

http://themeforest.net/forums/thread/wp-28-compatible/13432

#7 @ryan
7 years ago

Technically, these themes are broken in 2.7.1 as well, but the problem won't be evident unless you're using a custom taxonomies plugin. Maybe we can init the default taxonomies right before loading the theme's functions.php to paper over the issue.

@ryan
7 years ago

#8 @Denis-de-Bernardy
7 years ago

but in this case we'd lose the localization of the taxonomies. uploading a potential fix in a few minutes.

#9 @ryan
7 years ago

I added it after locale is setup. I think that will preserve localization.

#10 @ryan
7 years ago

However if someone manipulates the locale from functions.php, the taxonomies won't reflect that.

#11 @Denis-de-Bernardy
7 years ago

@ryan: yours works too, but doesn't fix #10160.

#12 @Denis-de-Bernardy
7 years ago

what I was thinking of is to disable the ability to override the default taxonomies.

#13 @Denis-de-Bernardy
7 years ago

nm previous comment. second patch works around the problem by doing this twice:

  • before plugins and themes are loaded
  • on the init hook to enforce localization

#14 @Denis-de-Bernardy
7 years ago

  • Keywords has-patch added; needs-patch removed
  • Severity changed from major to critical

making this a blocker, as it's apparently critical to quite a few users.

#15 @ryan
7 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [11573]) Register default taxonomies before theme functions are loaded to satisfy themes that don't wait until init to call taxonomy functions. Default taxonomies are registered again during init so that translations are handled correctly. Props Denis-de-Bernardy. fixes #9644 for trunk

#16 @ryan
7 years ago

(In [11574]) Register default taxonomies before theme functions are loaded to satisfy themes that don't wait until init to call taxonomy functions. Default taxonomies are registered again during init so that translations are handled correctly. Props Denis-de-Bernardy. fixes #9644 for 2.8.1

#17 @ryan
7 years ago

Tested with French and Spanish translations and with a couple custom taxonomy plugins.

Note: See TracTickets for help on using tickets.