WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 8 months ago

#15029 closed defect (bug) (fixed)

Make it possible to determine resource in get_ancestors()

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

Description

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 5 years ago.
determine_ancestor_resource_type.15029.2.diff (2.2 KB) - added by filosofo 5 years ago.
determine_ancestor_resource_type.15029.3.diff (2.2 KB) - added by filosofo 5 years ago.
15029.patch (7.0 KB) - added by boonebgorges 9 months ago.

Download all attachments as: .zip

Change History (16)

comment:1 @filosofo5 years ago

Please ignore the first patch with its logic flaw.

comment:2 @demetris5 years ago

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

comment:3 @filosofo5 years ago

Well, time to get some coffee.

comment:4 @scribu5 years ago

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

comment:5 @scribu5 years ago

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

comment:6 follow-up: @scribu5 years ago

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

comment:7 in reply to: ↑ 6 @filosofo5 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.

comment:8 @scribu5 years ago

  • Keywords needs-refresh added

comment:9 @scribu5 years ago

  • Milestone changed from 3.1 to Future Release

Enhancement, no patch, punting.

comment:10 @nacin18 months ago

  • Component changed from General to Taxonomy

@boonebgorges9 months ago

comment:11 @boonebgorges9 months 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.

comment:12 @boonebgorges8 months 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.