WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 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 6 years ago.
9644.2.diff (519 bytes) - added by Denis-de-Bernardy 6 years ago.

Download all attachments as: .zip

Change History (19)

comment:1 @mtekk6 years ago

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

Works for me in r11082

comment:2 @arena6 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."

comment:3 @DD326 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)

comment:4 @DD326 years ago

  • Milestone 2.8 deleted

comment:5 @michaelh6 years ago

  • Resolution worksforme deleted
  • Status changed from closed to reopened

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

comment:6 @michaelh6 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

comment:7 @ryan6 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.

@ryan6 years ago

comment:8 @Denis-de-Bernardy6 years ago

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

comment:9 @ryan6 years ago

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

comment:10 @ryan6 years ago

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

comment:11 @Denis-de-Bernardy6 years ago

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

comment:12 @Denis-de-Bernardy6 years ago

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

@Denis-de-Bernardy6 years ago

comment:13 @Denis-de-Bernardy6 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

comment:14 @Denis-de-Bernardy6 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.

comment:15 @ryan6 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

comment:16 @ryan6 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

comment:17 @ryan6 years ago

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

Note: See TracTickets for help on using tickets.