[wp-trac] [WordPress Trac] #58087: Fix the 'data' dynamic property in WP_Term

WordPress Trac noreply at wordpress.org
Sat Feb 17 16:46:53 UTC 2024


#58087: Fix the 'data' dynamic property in WP_Term
-------------------------------------+-------------------------------------
 Reporter:  antonvlasenko            |       Owner:  hellofromTonya
     Type:  defect (bug)             |      Status:  reviewing
 Priority:  normal                   |   Milestone:  6.5
Component:  Taxonomy                 |     Version:  6.3
 Severity:  minor                    |  Resolution:
 Keywords:  php82 has-patch has-     |     Focuses:  coding-standards, php-
  unit-tests needs-testing changes-  |  compatibility
  requested                          |
-------------------------------------+-------------------------------------

Comment (by antonvlasenko):

 I see an issue with removing the use of the `WP_Term::$data` property from
 Core and removing the `WP_Term::__get()` magic method, as there are
 plugins that utilize `WP_Term::$data`:
 * **WordPress Tag and Category Manager – AI Autotagger** (60 thousand
 installations);
 * **Connections Business Directory** - (8 thousand installations)
 (data from [https://www.wpdirectory.net/search/01HPVSP5CSY4R3NFSXT3FNHNBS
 wpdirectory]).

 I really don't know how critical it will be that about 68 thousand
 WordPress sites might stop working (though the actual number affected will
 likely be much lower).

 Therefore, the most viable solution, in my opinion, is to explicitly
 declare the `WP_Term::$data` class property and initialize it in the class
 constructor, as suggested by @hellofromTonya in
 https://core.trac.wordpress.org/ticket/58087#comment:24.

 P.S. Regarding the [https://github.com/WordPress/wordpress-
 develop/pull/4307 PR I submitted earlier]: I have changed my mind, and I
 no longer believe it is necessary to use a new public method -
 `WP_Term::get_raw_data()`, as I had proposed.
 Recalculating the value of `WP_Term::$data` due to potential changes in
 the values of its constituent properties does not seem to be commonly
 required. I wish I had provided a more detailed explanation of my
 reasoning in https://core.trac.wordpress.org/ticket/58087#comment:6.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58087#comment:25>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list