From 045ce2e9133b48a4d067168ed1bb7f92cf9b962b Mon Sep 17 00:00:00 2001 From: Joe Maller Date: Sat, 17 Feb 2024 11:17:11 -0500 Subject: [PATCH] Rename top-level label to match the labels property --- src/Rename.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/Rename.php b/src/Rename.php index 9f62bf7..a4c0f6b 100644 --- a/src/Rename.php +++ b/src/Rename.php @@ -64,17 +64,13 @@ protected static function update($object, $labelBase, $inflect = true, $override * Assign new labels to native objects */ if (array_key_exists($object, $wp_post_types)) { - $wp_post_types[$object]->labels = DataModel::postTypeLabels( - $labelBase, - $inflect, - $overrides - ); + $labels = DataModel::postTypeLabels($labelBase, $inflect, $overrides); + $wp_post_types[$object]->label = $labels->name; + $wp_post_types[$object]->labels = $labels; } elseif (array_key_exists($object, $wp_taxonomies)) { - $wp_taxonomies[$object]->labels = DataModel::taxonomyLabels( - $labelBase, - $inflect, - $overrides - ); + $labels = DataModel::taxonomyLabels($labelBase, $inflect, $overrides); + $wp_taxonomies[$object]->label = $labels->name; + $wp_taxonomies[$object]->labels = $labels; } else { new Error("'{$object}' is not a known Post_type or Taxonomy. Unable to rename."); }