| 10 | | >`wp_ajax_add_term()` fetches a term using `get_term()`, and passes the term to |
| 11 | | `WP_Ajax_Response`, which expects each of the term's properties to be scalar. |
| 12 | | Having `$data` as a `stdClass` (meant to mimic `WP_User::data`, populated by |
| 13 | | a `get_row()` database query) violated this expectation, causing fatal string |
| 14 | | conversion errors. As a workaround, `$term->data` is converted so that it is |
| 15 | | no longer an actual property of the term object, but is assembled only when |
| 16 | | requested in the magic `__get()` method. |
| | 10 | >`wp_ajax_add_term()` fetches a term using `get_term()`, and passes the term to `WP_Ajax_Response`, which expects each of the term's properties to be scalar. Having `$data` as a `stdClass` (meant to mimic `WP_User::data`, populated by a `get_row()` database query) violated this expectation, causing fatal string conversion errors. As a workaround, `$term->data` is converted so that it is no longer an actual property of the term object, but is assembled only when requested in the magic `__get()` method. |