Make WordPress Core

Opened 14 years ago

Closed 10 years ago

#15029 closed defect (bug) (fixed)

Make it possible to determine resource in get_ancestors()

Reported by: filosofo's profile filosofo Owned by: boonebgorges's profile boonebgorges
Milestone: 4.1 Priority: normal
Severity: normal Version: 3.1
Component: Taxonomy Keywords: has-patch
Focuses: Cc:


In case there exists a conflict between taxonomy and post_type names, allow it to be resolved explicitly when calling get_ancestors().

Attachments (4)

determine_ancestor_resource_type.15029.diff (2.1 KB) - added by filosofo 14 years ago.
determine_ancestor_resource_type.15029.2.diff (2.2 KB) - added by filosofo 14 years ago.
determine_ancestor_resource_type.15029.3.diff (2.2 KB) - added by filosofo 14 years ago.
15029.patch (7.0 KB) - added by boonebgorges 10 years ago.

Download all attachments as: .zip

Change History (16)

#1 @filosofo
14 years ago

Please ignore the first patch with its logic flaw.

#2 @demetris
14 years ago

There is a typo in the @param doc line for the new parameter: resorce. :-)

#3 @filosofo
14 years ago

Well, time to get some coffee.

#4 @scribu
14 years ago

I think we should prevent conflicts between post_type and taxonomy names at the registration step, not later.

#5 @scribu
14 years ago

On second thought, nevermind. I was thinking about query_var, which doesn't have to corespond to the taxonomy name.

#6 follow-up: @scribu
14 years ago

By the way, shouldn't we also check if the post type is hierarchical, like we do for taxonomies?

#7 in reply to: ↑ 6 @filosofo
14 years ago

Replying to scribu:

By the way, shouldn't we also check if the post type is hierarchical, like we do for taxonomies?

Agreed; I don't think is_post_type_hierarchical existed when I wrote the original patch.

I also agree that checking query_var and maybe rewrite slug are good ideas.

#8 @scribu
14 years ago

  • Keywords needs-refresh added

#9 @scribu
13 years ago

  • Milestone changed from 3.1 to Future Release

Enhancement, no patch, punting.

#10 @nacin
10 years ago

  • Component changed from General to Taxonomy

10 years ago

#11 @boonebgorges
10 years ago

  • Keywords needs-refresh removed
  • Milestone changed from Future Release to 4.1
  • Owner changed from filosofo to boonebgorges
  • Status changed from new to accepted

15029.patch refreshes the patch for the modern age.

#12 @boonebgorges
10 years ago

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

In 30141:

Allow resource_type to be specified in get_ancestors().

Being explicit about resource type (taxonomy vs post_type) allows for the
proper resolution of conflicts when a taxonomy and post_type share a slug.

Props filosofo.
Fixes #15029.

Note: See TracTickets for help on using tickets.