run:R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:51
R W Run
23.8 KB
2026-03-11 16:18:51
R W Run
7.8 KB
2026-03-11 16:18:52
R W Run
36.1 KB
2026-03-11 16:18:51
R W Run
11.9 KB
2026-03-11 16:18:52
R W Run
18.94 KB
2026-03-11 16:18:52
R W Run
7.35 KB
2026-03-11 16:18:52
R W Run
28.6 KB
2026-03-11 16:18:51
R W Run
316 By
2026-03-11 16:18:51
R W Run
12.9 KB
2026-03-11 16:18:51
R W Run
61.02 KB
2026-03-11 16:18:52
R W Run
15 KB
2026-03-11 16:18:51
R W Run
112.05 KB
2026-03-11 16:18:51
R W Run
12.47 KB
2026-03-11 16:18:51
R W Run
15.07 KB
2026-03-11 16:18:52
R W Run
9.84 KB
2026-03-11 16:18:52
R W Run
13.17 KB
2026-03-11 16:18:52
R W Run
33.83 KB
2026-03-11 16:18:51
R W Run
42.63 KB
2026-03-11 16:18:51
R W Run
55.71 KB
2026-03-11 16:18:52
R W Run
12.53 KB
2026-03-11 16:18:51
R W Run
2.55 KB
2026-03-11 16:18:52
R W Run
28.92 KB
2026-03-11 16:18:52
R W Run
539 By
2026-03-11 16:18:51
R W Run
367 By
2026-03-11 16:18:52
R W Run
42.65 KB
2026-03-11 16:18:51
R W Run
401 By
2026-03-11 16:18:51
R W Run
6.61 KB
2026-03-11 16:18:51
R W Run
664 By
2026-03-11 16:18:52
R W Run
20.63 KB
2026-03-11 16:18:51
R W Run
2.18 KB
2026-03-11 16:18:52
R W Run
453 By
2026-03-11 16:18:52
R W Run
457 By
2026-03-11 16:18:51
R W Run
36.83 KB
2026-03-11 16:18:52
R W Run
2.41 KB
2026-03-11 16:18:52
R W Run
8.28 KB
2026-03-11 16:18:51
R W Run
13.89 KB
2026-03-11 16:18:51
R W Run
11.76 KB
2026-03-11 16:18:51
R W Run
2.65 KB
2026-03-11 16:18:51
R W Run
7.43 KB
2026-03-11 16:18:51
R W Run
17.46 KB
2026-03-11 16:18:51
R W Run
5.14 KB
2026-03-11 16:18:52
R W Run
16.7 KB
2026-03-11 16:18:51
R W Run
8.28 KB
2026-03-11 16:18:52
R W Run
2.92 KB
2026-03-11 16:18:52
R W Run
1.32 KB
2026-03-11 16:18:51
R W Run
4.6 KB
2026-03-11 16:18:52
R W Run
11.62 KB
2026-03-11 16:18:52
R W Run
2.5 KB
2026-03-11 16:18:51
R W Run
1.97 KB
2026-03-11 16:18:51
R W Run
11.25 KB
2026-03-11 16:18:52
R W Run
5.32 KB
2026-03-11 16:18:51
R W Run
10.99 KB
2026-03-11 16:18:52
R W Run
68.32 KB
2026-03-11 16:18:51
R W Run
6.34 KB
2026-03-11 16:18:51
R W Run
5.49 KB
2026-03-11 16:18:51
R W Run
1.99 KB
2026-03-11 16:18:52
R W Run
7.02 KB
2026-03-11 16:18:51
R W Run
4.91 KB
2026-03-11 16:18:52
R W Run
16.86 KB
2026-03-11 16:18:51
R W Run
24.23 KB
2026-03-11 16:18:51
R W Run
3.97 KB
2026-03-11 16:18:51
R W Run
47.66 KB
2026-03-11 16:18:51
R W Run
9.22 KB
2026-03-11 16:18:51
R W Run
25.51 KB
2026-03-11 16:18:51
R W Run
198.38 KB
2026-03-11 16:18:52
R W Run
56.65 KB
2026-03-11 16:18:51
R W Run
10.46 KB
2026-03-11 16:18:51
R W Run
10.95 KB
2026-03-11 16:18:52
R W Run
29.26 KB
2026-03-11 16:18:51
R W Run
70.91 KB
2026-03-11 16:18:52
R W Run
35.3 KB
2026-03-11 16:18:52
R W Run
16.61 KB
2026-03-11 16:18:52
R W Run
2.57 KB
2026-03-11 16:18:52
R W Run
39.83 KB
2026-03-11 16:18:51
R W Run
70.64 KB
2026-03-11 16:18:51
R W Run
15.56 KB
2026-03-11 16:18:52
R W Run
7.33 KB
2026-03-11 16:18:52
R W Run
253 By
2026-03-11 16:18:51
R W Run
7.96 KB
2026-03-11 16:18:52
R W Run
3.23 KB
2026-03-11 16:18:52
R W Run
969 By
2026-03-11 16:18:52
R W Run
16.28 KB
2026-03-11 16:18:51
R W Run
7.22 KB
2026-03-11 16:18:51
R W Run
12.95 KB
2026-03-11 16:18:51
R W Run
6.53 KB
2026-03-11 16:18:51
R W Run
3.42 KB
2026-03-11 16:18:52
R W Run
5.84 KB
2026-03-11 16:18:51
R W Run
1.97 KB
2026-03-11 16:18:51
R W Run
4.3 KB
2026-03-11 16:18:52
R W Run
2.91 KB
2026-03-11 16:18:51
R W Run
16.46 KB
2026-03-11 16:18:52
R W Run
40.6 KB
2026-03-11 16:18:51
R W Run
20.22 KB
2026-03-11 16:18:51
R W Run
36.11 KB
2026-03-11 16:18:52
R W Run
17.01 KB
2026-03-11 16:18:51
R W Run
7.27 KB
2026-03-11 16:18:52
R W Run
6.62 KB
2026-03-11 16:18:52
R W Run
16.49 KB
2026-03-11 16:18:52
R W Run
1.79 KB
2026-03-11 16:18:52
R W Run
29.82 KB
2026-03-11 16:18:51
R W Run
6.67 KB
2026-03-11 16:18:52
R W Run
8.98 KB
2026-03-11 16:18:52
R W Run
19.42 KB
2026-03-11 16:18:51
R W Run
12.01 KB
2026-03-11 16:18:51
R W Run
17.11 KB
2026-03-11 16:18:51
R W Run
6.74 KB
2026-03-11 16:18:52
R W Run
30.93 KB
2026-03-11 16:18:51
R W Run
4.99 KB
2026-03-11 16:18:51
R W Run
4.25 KB
2026-03-11 16:18:51
R W Run
24.72 KB
2026-03-11 16:18:51
R W Run
29.96 KB
2026-03-11 16:18:52
R W Run
6.41 KB
2026-03-11 16:18:51
R W Run
160 KB
2026-03-11 16:18:51
R W Run
6.72 KB
2026-03-11 16:18:52
R W Run
10.92 KB
2026-03-11 16:18:51
R W Run
4.77 KB
2026-03-11 16:18:51
R W Run
3.38 KB
2026-03-11 16:18:51
R W Run
11.18 KB
2026-03-11 16:18:51
R W Run
62.19 KB
2026-03-11 16:18:51
R W Run
2.46 KB
2026-03-11 16:18:51
R W Run
9.17 KB
2026-03-11 16:18:51
R W Run
32.15 KB
2026-03-11 16:18:51
R W Run
34.05 KB
2026-03-11 16:18:52
R W Run
7.15 KB
2026-03-11 16:18:51
R W Run
3.47 KB
2026-03-11 16:18:52
R W Run
1.87 KB
2026-03-11 16:18:52
R W Run
30.91 KB
2026-03-11 16:18:51
R W Run
7.29 KB
2026-03-11 16:18:52
R W Run
7.35 KB
2026-03-11 16:18:51
R W Run
12.54 KB
2026-03-11 16:18:51
R W Run
19.12 KB
2026-03-11 16:18:51
R W Run
18.12 KB
2026-03-11 16:18:52
R W Run
39.99 KB
2026-03-11 16:18:52
R W Run
5.17 KB
2026-03-11 16:18:52
R W Run
979 By
2026-03-11 16:18:51
R W Run
18.44 KB
2026-03-11 16:18:52
R W Run
10.24 KB
2026-03-11 16:18:51
R W Run
1.77 KB
2026-03-11 16:18:52
R W Run
34.9 KB
2026-03-11 16:18:51
R W Run
7.19 KB
2026-03-11 16:18:52
R W Run
160.5 KB
2026-03-11 16:18:51
R W Run
64.27 KB
2026-03-11 16:18:51
R W Run
27.95 KB
2026-03-11 16:18:51
R W Run
4.69 KB
2026-03-11 16:18:51
R W Run
2.94 KB
2026-03-11 16:18:51
R W Run
43.13 KB
2026-03-11 16:18:52
R W Run
2.25 KB
2026-03-11 16:18:52
R W Run
22.5 KB
2026-03-11 16:18:51
R W Run
13.01 KB
2026-03-11 16:18:52
R W Run
3.27 KB
2026-03-11 16:18:51
R W Run
18 KB
2026-03-11 16:18:51
R W Run
210.4 KB
2026-03-11 16:18:52
R W Run
25.86 KB
2026-03-11 16:18:52
R W Run
115.85 KB
2026-03-11 16:18:51
R W Run
373 By
2026-03-11 16:18:52
R W Run
343 By
2026-03-11 16:18:52
R W Run
338 By
2026-03-11 16:18:51
R W Run
100.73 KB
2026-03-11 16:18:52
R W Run
130.93 KB
2026-03-11 16:18:51
R W Run
19.1 KB
2026-03-11 16:18:51
R W Run
17.41 KB
2026-03-11 16:18:52
R W Run
41.98 KB
2026-03-11 16:18:52
R W Run
400 By
2026-03-11 16:18:52
R W Run
11.1 KB
2026-03-11 16:18:52
R W Run
37.02 KB
2026-03-11 16:18:51
R W Run
2.24 KB
2026-03-11 16:18:51
R W Run
188.13 KB
2026-03-11 16:18:51
R W Run
338 By
2026-03-11 16:18:51
R W Run
38 KB
2026-03-11 16:18:51
R W Run
4.02 KB
2026-03-11 16:18:52
R W Run
5.38 KB
2026-03-11 16:18:51
R W Run
3.05 KB
2026-03-11 16:18:52
R W Run
2.61 KB
2026-03-11 16:18:51
R W Run
1.16 KB
2026-03-11 16:18:52
R W Run
4.04 KB
2026-03-11 16:18:51
R W Run
3.71 KB
2026-03-11 16:18:51
R W Run
24.6 KB
2026-03-11 16:18:51
R W Run
9.56 KB
2026-03-11 16:18:51
R W Run
346.43 KB
2026-03-11 16:18:52
R W Run
281.84 KB
2026-03-11 16:18:52
R W Run
14.95 KB
2026-03-11 16:18:51
R W Run
8.44 KB
2026-03-11 16:18:52
R W Run
168.95 KB
2026-03-11 16:18:52
R W Run
20.71 KB
2026-03-11 16:18:52
R W Run
25.27 KB
2026-03-11 16:18:51
R W Run
5.72 KB
2026-03-11 16:18:51
R W Run
4.63 KB
2026-03-11 16:18:52
R W Run
81.73 KB
2026-03-11 16:18:51
R W Run
67.18 KB
2026-03-11 16:18:51
R W Run
156.36 KB
2026-03-11 16:18:52
R W Run
55.19 KB
2026-03-11 16:18:51
R W Run
162 By
2026-03-11 16:18:51
R W Run
61.72 KB
2026-03-11 16:18:51
R W Run
216.06 KB
2026-03-11 16:18:52
R W Run
65.09 KB
2026-03-11 16:18:51
R W Run
25.24 KB
2026-03-11 16:18:52
R W Run
4.81 KB
2026-03-11 16:18:51
R W Run
6.48 KB
2026-03-11 16:18:52
R W Run
21.25 KB
2026-03-11 16:18:51
R W Run
2.79 KB
2026-03-11 16:18:52
R W Run
89.69 KB
2026-03-11 16:18:52
R W Run
19.42 KB
2026-03-11 16:18:52
R W Run
3.69 KB
2026-03-11 16:18:52
R W Run
4.11 KB
2026-03-11 16:18:51
R W Run
40.74 KB
2026-03-11 16:18:51
R W Run
25.38 KB
2026-03-11 16:18:51
R W Run
43.31 KB
2026-03-11 16:18:52
R W Run
102.57 KB
2026-03-11 16:18:52
R W Run
6.18 KB
2026-03-11 16:18:51
R W Run
124.47 KB
2026-03-11 16:18:52
R W Run
35.65 KB
2026-03-11 16:18:52
R W Run
6.94 KB
2026-03-11 16:18:52
R W Run
67.04 KB
2026-03-11 16:18:52
R W Run
10.62 KB
2026-03-11 16:18:51
R W Run
289.35 KB
2026-03-11 16:18:52
R W Run
36.23 KB
2026-03-11 16:18:51
R W Run
200 By
2026-03-11 16:18:52
R W Run
200 By
2026-03-11 16:18:52
R W Run
98.29 KB
2026-03-11 16:18:52
R W Run
30.02 KB
2026-03-11 16:18:52
R W Run
19.03 KB
2026-03-11 16:18:52
R W Run
5.06 KB
2026-03-11 16:18:52
R W Run
255 By
2026-03-11 16:18:51
R W Run
22.66 KB
2026-03-11 16:18:52
R W Run
154.63 KB
2026-03-11 16:18:51
R W Run
9.68 KB
2026-03-11 16:18:51
R W Run
258 By
2026-03-11 16:18:51
R W Run
23.49 KB
2026-03-11 16:18:51
R W Run
3.16 KB
2026-03-11 16:18:51
R W Run
8.4 KB
2026-03-11 16:18:52
R W Run
441 By
2026-03-11 16:18:51
R W Run
7.39 KB
2026-03-11 16:18:51
R W Run
173 KB
2026-03-11 16:18:52
R W Run
544 By
2026-03-11 16:18:52
R W Run
4.17 KB
2026-03-11 16:18:51
R W Run
35.97 KB
2026-03-11 16:18:52
R W Run
1.69 KB
2026-03-11 16:18:51
R W Run
2.84 KB
2026-03-11 16:18:52
R W Run
6.09 KB
2026-03-11 16:18:51
R W Run
8.71 KB
2026-03-11 16:18:51
R W Run
131.84 KB
2026-03-11 16:18:51
R W Run
37.45 KB
2026-03-11 16:18:51
R W Run
173.89 KB
2026-03-11 16:18:51
R W Run
7.09 KB
2026-03-11 16:18:51
R W Run
6.41 KB
2026-03-11 16:18:51
R W Run
1.08 KB
2026-03-11 16:18:51
R W Run
69.46 KB
2026-03-11 16:18:52
R W Run
445 By
2026-03-11 16:18:51
R W Run
799 By
2026-03-11 16:18:52
R W Run
error_log
📄class-wp-comment.php
1<?php
2/**
3 * Comment API: WP_Comment class
4 *
5 * @package WordPress
6 * @subpackage Comments
7 * @since 4.4.0
8 */
9
10/**
11 * Core class used to organize comments as instantiated objects with defined members.
12 *
13 * @since 4.4.0
14 */
15#[AllowDynamicProperties]
16final class WP_Comment {
17
18 /**
19 * Comment ID.
20 *
21 * A numeric string, for compatibility reasons.
22 *
23 * @since 4.4.0
24 * @var string
25 */
26 public $comment_ID;
27
28 /**
29 * ID of the post the comment is associated with.
30 *
31 * A numeric string, for compatibility reasons.
32 *
33 * @since 4.4.0
34 * @var string
35 */
36 public $comment_post_ID = '0';
37
38 /**
39 * Comment author name.
40 *
41 * @since 4.4.0
42 * @var string
43 */
44 public $comment_author = '';
45
46 /**
47 * Comment author email address.
48 *
49 * @since 4.4.0
50 * @var string
51 */
52 public $comment_author_email = '';
53
54 /**
55 * Comment author URL.
56 *
57 * @since 4.4.0
58 * @var string
59 */
60 public $comment_author_url = '';
61
62 /**
63 * Comment author IP address (IPv4 format).
64 *
65 * @since 4.4.0
66 * @var string
67 */
68 public $comment_author_IP = '';
69
70 /**
71 * Comment date in YYYY-MM-DD HH:MM:SS format.
72 *
73 * @since 4.4.0
74 * @var string
75 */
76 public $comment_date = '0000-00-00 00:00:00';
77
78 /**
79 * Comment GMT date in YYYY-MM-DD HH::MM:SS format.
80 *
81 * @since 4.4.0
82 * @var string
83 */
84 public $comment_date_gmt = '0000-00-00 00:00:00';
85
86 /**
87 * Comment content.
88 *
89 * @since 4.4.0
90 * @var string
91 */
92 public $comment_content;
93
94 /**
95 * Comment karma count.
96 *
97 * A numeric string, for compatibility reasons.
98 *
99 * @since 4.4.0
100 * @var string
101 */
102 public $comment_karma = '0';
103
104 /**
105 * Comment approval status.
106 *
107 * @since 4.4.0
108 * @var string
109 */
110 public $comment_approved = '1';
111
112 /**
113 * Comment author HTTP user agent.
114 *
115 * @since 4.4.0
116 * @var string
117 */
118 public $comment_agent = '';
119
120 /**
121 * Comment type.
122 *
123 * @since 4.4.0
124 * @since 5.5.0 Default value changed to `comment`.
125 * @var string
126 */
127 public $comment_type = 'comment';
128
129 /**
130 * Parent comment ID.
131 *
132 * A numeric string, for compatibility reasons.
133 *
134 * @since 4.4.0
135 * @var string
136 */
137 public $comment_parent = '0';
138
139 /**
140 * Comment author ID.
141 *
142 * A numeric string, for compatibility reasons.
143 *
144 * @since 4.4.0
145 * @var string
146 */
147 public $user_id = '0';
148
149 /**
150 * Comment children.
151 *
152 * @since 4.4.0
153 * @var array
154 */
155 protected $children;
156
157 /**
158 * Whether children have been populated for this comment object.
159 *
160 * @since 4.4.0
161 * @var bool
162 */
163 protected $populated_children = false;
164
165 /**
166 * Post fields.
167 *
168 * @since 4.4.0
169 * @var array
170 */
171 protected $post_fields = array( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'comment_status', 'ping_status', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_content_filtered', 'post_parent', 'guid', 'menu_order', 'post_type', 'post_mime_type', 'comment_count' );
172
173 /**
174 * Retrieves a WP_Comment instance.
175 *
176 * @since 4.4.0
177 *
178 * @global wpdb $wpdb WordPress database abstraction object.
179 *
180 * @param int $id Comment ID.
181 * @return WP_Comment|false Comment object, otherwise false.
182 */
183 public static function get_instance( $id ) {
184 global $wpdb;
185
186 $comment_id = (int) $id;
187 if ( ! $comment_id ) {
188 return false;
189 }
190
191 $_comment = wp_cache_get( $comment_id, 'comment' );
192
193 if ( ! $_comment ) {
194 $_comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment_id ) );
195
196 if ( ! $_comment ) {
197 return false;
198 }
199
200 wp_cache_add( $_comment->comment_ID, $_comment, 'comment' );
201 }
202
203 return new WP_Comment( $_comment );
204 }
205
206 /**
207 * Constructor.
208 *
209 * Populates properties with object vars.
210 *
211 * @since 4.4.0
212 *
213 * @param WP_Comment $comment Comment object.
214 */
215 public function __construct( $comment ) {
216 foreach ( get_object_vars( $comment ) as $key => $value ) {
217 $this->$key = $value;
218 }
219 }
220
221 /**
222 * Converts object to array.
223 *
224 * @since 4.4.0
225 *
226 * @return array Object as array.
227 */
228 public function to_array() {
229 return get_object_vars( $this );
230 }
231
232 /**
233 * Gets the children of a comment.
234 *
235 * @since 4.4.0
236 *
237 * @param array $args {
238 * Array of arguments used to pass to get_comments() and determine format.
239 *
240 * @type string $format Return value format. 'tree' for a hierarchical tree, 'flat' for a flattened array.
241 * Default 'tree'.
242 * @type string $status Comment status to limit results by. Accepts 'hold' (`comment_status=0`),
243 * 'approve' (`comment_status=1`), 'all', or a custom comment status.
244 * Default 'all'.
245 * @type string $hierarchical Whether to include comment descendants in the results.
246 * 'threaded' returns a tree, with each comment's children
247 * stored in a `children` property on the `WP_Comment` object.
248 * 'flat' returns a flat array of found comments plus their children.
249 * Pass `false` to leave out descendants.
250 * The parameter is ignored (forced to `false`) when `$fields` is 'ids' or 'counts'.
251 * Accepts 'threaded', 'flat', or false. Default: 'threaded'.
252 * @type string|array $orderby Comment status or array of statuses. To use 'meta_value'
253 * or 'meta_value_num', `$meta_key` must also be defined.
254 * To sort by a specific `$meta_query` clause, use that
255 * clause's array key. Accepts 'comment_agent',
256 * 'comment_approved', 'comment_author',
257 * 'comment_author_email', 'comment_author_IP',
258 * 'comment_author_url', 'comment_content', 'comment_date',
259 * 'comment_date_gmt', 'comment_ID', 'comment_karma',
260 * 'comment_parent', 'comment_post_ID', 'comment_type',
261 * 'user_id', 'comment__in', 'meta_value', 'meta_value_num',
262 * the value of $meta_key, and the array keys of
263 * `$meta_query`. Also accepts false, an empty array, or
264 * 'none' to disable `ORDER BY` clause.
265 * }
266 * @return WP_Comment[] Array of `WP_Comment` objects.
267 */
268 public function get_children( $args = array() ) {
269 $defaults = array(
270 'format' => 'tree',
271 'status' => 'all',
272 'hierarchical' => 'threaded',
273 'orderby' => '',
274 );
275
276 $_args = wp_parse_args( $args, $defaults );
277 $_args['parent'] = $this->comment_ID;
278
279 if ( is_null( $this->children ) ) {
280 if ( $this->populated_children ) {
281 $this->children = array();
282 } else {
283 $this->children = get_comments( $_args );
284 }
285 }
286
287 if ( 'flat' === $_args['format'] ) {
288 $children = array();
289 foreach ( $this->children as $child ) {
290 $child_args = $_args;
291 $child_args['format'] = 'flat';
292 // get_children() resets this value automatically.
293 unset( $child_args['parent'] );
294
295 $children = array_merge( $children, array( $child ), $child->get_children( $child_args ) );
296 }
297 } else {
298 $children = $this->children;
299 }
300
301 return $children;
302 }
303
304 /**
305 * Adds a child to the comment.
306 *
307 * Used by `WP_Comment_Query` when bulk-filling descendants.
308 *
309 * @since 4.4.0
310 *
311 * @param WP_Comment $child Child comment.
312 */
313 public function add_child( WP_Comment $child ) {
314 $this->children[ $child->comment_ID ] = $child;
315 }
316
317 /**
318 * Gets a child comment by ID.
319 *
320 * @since 4.4.0
321 *
322 * @param int $child_id ID of the child.
323 * @return WP_Comment|false Returns the comment object if found, otherwise false.
324 */
325 public function get_child( $child_id ) {
326 if ( isset( $this->children[ $child_id ] ) ) {
327 return $this->children[ $child_id ];
328 }
329
330 return false;
331 }
332
333 /**
334 * Sets the 'populated_children' flag.
335 *
336 * This flag is important for ensuring that calling `get_children()` on a childless comment will not trigger
337 * unneeded database queries.
338 *
339 * @since 4.4.0
340 *
341 * @param bool $set Whether the comment's children have already been populated.
342 */
343 public function populated_children( $set ) {
344 $this->populated_children = (bool) $set;
345 }
346
347 /**
348 * Determines whether a non-public property is set.
349 *
350 * If `$name` matches a post field, the comment post will be loaded and the post's value checked.
351 *
352 * @since 4.4.0
353 *
354 * @param string $name Property to check if set.
355 * @return bool Whether the property is set.
356 */
357 public function __isset( $name ) {
358 if ( in_array( $name, $this->post_fields, true ) && 0 !== (int) $this->comment_post_ID ) {
359 $post = get_post( $this->comment_post_ID );
360 return property_exists( $post, $name );
361 }
362
363 return false;
364 }
365
366 /**
367 * Magic getter.
368 *
369 * If `$name` matches a post field, the comment post will be loaded and the post's value returned.
370 *
371 * @since 4.4.0
372 *
373 * @param string $name Property name.
374 * @return mixed
375 */
376 public function __get( $name ) {
377 if ( in_array( $name, $this->post_fields, true ) ) {
378 $post = get_post( $this->comment_post_ID );
379 return $post->$name;
380 }
381 }
382}
383
Ui Ux Design – Teachers Night Out

Get in Touch

© 2024 Teachers Night Out. All Rights Reserved.