[wp-trac] [WordPress Trac] #63521: fix: Avoid deprecated warnings on WP_Term

WordPress Trac noreply at wordpress.org
Tue Jun 3 11:31:13 UTC 2025


#63521: fix: Avoid deprecated warnings on WP_Term
-------------------------------+-----------------------------
 Reporter:  Jose Lazo          |      Owner:  (none)
     Type:  defect (bug)       |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Taxonomy           |    Version:  6.8
 Severity:  normal             |   Keywords:  dev-feedback
  Focuses:  php-compatibility  |
-------------------------------+-----------------------------
 WP version: 6.8
 PHP version: 8.2
 Environment: Official Docker image with WP_UnitTest

 Adding a unit test environment using WP_UnitTests, xdebug throws several
 {{{Deprecated: Creation of dynamic property WP_Term::$category_description
 is deprecated}}} warnings.

 The issue points to the {{{_make_cat_compat}}} function because it tries
 to assign values ​​to object properties that are not defined in
 {{{WP_Term}}}.

 I suggest defining the old properties on WP_Terms


 {{{
 Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated
 in /var/www/html/wp-content/themes/themename/tests/wordpress-develop/src
 /wp-includes/category.php on line 381

 Deprecated: Creation of dynamic property WP_Term::$category_nicename is
 deprecated in /var/www/html/wp-content/themes/themename/tests/wordpress-
 develop/src/wp-includes/category.php on line 382

 Deprecated: Creation of dynamic property WP_Term::$category_parent is
 deprecated in /var/www/html/wp-content/themes/themename/tests/wordpress-
 develop/src/wp-includes/category.php on line 383
  ✔ Exclude ab test from query method

 Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in
 /var/www/html/wp-content/themes/themename/tests/wordpress-develop/src/wp-
 includes/category.php on line 378

 Deprecated: Creation of dynamic property WP_Term::$category_count is
 deprecated in /var/www/html/wp-content/themes/themename/tests/wordpress-
 develop/src/wp-includes/category.php on line 379

 Deprecated: Creation of dynamic property WP_Term::$category_description is
 deprecated in /var/www/html/wp-content/themes/themename/tests/wordpress-
 develop/src/wp-includes/category.php on line 380

 Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated
 in /var/www/html/wp-content/themes/themename/tests/wordpress-develop/src
 /wp-includes/category.php on line 381

 }}}

 After the fix:
 {{{
 AB_Test_Post_ (ThemeName\Tests\Theme\Growth\AB_Test_Post_)
  ✔ Alter post query method
  ✔ Add ab test post meta
  ✔ Maybe add no index meta tag method
  ✔ Render ab test settings meta box method
  ✔ Exclude ab test from query method
  ✔ Save ab test settings
  ✔ Add canonical url
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63521>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list