[wp-trac] [WordPress Trac] #50771: WP_Comment protected $children
WordPress Trac
noreply at wordpress.org
Sun Jul 26 07:10:42 UTC 2020
#50771: WP_Comment protected $children
-------------------------+-----------------------------
Reporter: Tkama | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 5.4.2
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
Why we need `$children` prop of `WP_Comment` class to be protected?
It's very inconvenient in some cases, for example, I use `get_comments()`
with `hierarchical => threaded` param and get comment objects which
contains nested comments:
{{{#!php
// I delete some fields of WP_Comment Object for convenience.
Array
[22986] => WP_Comment Object
[comment_ID] => 22986
[comment_post_ID] => 8342
[comment_author] => camp
[comment_date] => 2018-04-11 19:07:08
[comment_content] => Добавлено.
[comment_type] =>
[comment_parent] => 22430
[populated_children:protected] => 1
[children:protected] => Array
[22998] => WP_Comment Object
[comment_ID] => 22998
[comment_post_ID] => 8342
[comment_author] => Максим
[comment_date] => 2018-04-12
12:15:25
[comment_content] => Работает
отлично. Спасибо!
[comment_type] =>
[comment_parent] => 22986
[populated_children:protected] => 1
[children:protected] => Array
[23035] => WP_Comment Object
[comment_ID]
=> 23035
[comment_post_ID]
=> 8342
[comment_author]
=> camp
[comment_date]
=> 2018-04-16 15:36:00
[comment_content]
=> Спасибо за обратную связь!
[comment_type]
=>
[comment_parent]
=> 22998
[children:protected]
=>
[populated_children:protected] => 1
}}}
Now I want to use this nested data, but I can't access it.
Maybe make `$children` prop public?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50771>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list