Opened 15 years ago
Closed 7 years ago
#8050 closed enhancement (wontfix)
is_child()
Reported by: | youngmicroserf | Owned by: | westi |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | General | Keywords: | has-patch |
Focuses: | template | Cc: |
Description
Is there any reason why there is no native is_child(direct,in_tree) function for hierarchical structures in WP (like pages, categories, custom hierarchical taxonomies)? There's a (partly) working plugin available at
http://2pt3.com/post/wordpress-plugins/
but I think this amounts to a core functionality, particularly for people using WP as a hierarchical CMS.
Attachments (2)
Change History (21)
#5
@
14 years ago
- Keywords needs-patch added; is_child CMS selection removed
- Milestone changed from 3.0 to 3.1
Unfortunately this has missed the boat for 3.0 as we're in a feature freeze.
I'm not setting this to 3.1 due to there not being a patch. If someone provides a patch, it may be in 3.1.
#8
@
14 years ago
If we get #12443 in, is_child() would be as simple as:
function is_child( $child, $parent, $object_type ) { return in_array( $parent, get_ancestors( $child, $object_type ) ); }
#12
@
14 years ago
I was about to make cat_is_ancestor_of() use get_ancestors().
Then I realized that cat_is_ancestor_of(), as it is now, will stop once it finds a match, whereas get_ancestors() wouldn't.
So yeah, disregard comment:8
#13
@
13 years ago
- Milestone changed from Awaiting Triage to Future Release
Still just needs a patch.
This ticket was mentioned in IRC in #wordpress-dev by helen. View the logs.
10 years ago
#19
@
7 years ago
- Milestone Future Release deleted
- Resolution set to wontfix
- Status changed from accepted to closed
I can't imagine using this myself - anyone care to share a use-case?
Agreed. Especially since it's now just a 1-liner.
Closing as wontfix because of a lack of traction. Feel free to reopen when some valid use cases for themes, plugins, and/or core emerge.
Bumping this up.