Opened 18 years ago
Closed 10 years ago
#8050 closed enhancement (wontfix)
is_child()
| Reported by: | youngmicroserf | Owned by: | westi |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | General | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: | template |
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
@
17 years ago
- Keywords needs-patch added; is_child CMS selection removed
- Milestone 3.0 → 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
@
16 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
@
16 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
This ticket was mentioned in IRC in #wordpress-dev by helen. View the logs.
13 years ago
#19
@
10 years ago
- Milestone Future Release
- Resolution → wontfix
- Status accepted → 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Bumping this up.