Skip to content

Commit

Permalink
Rename top-level label to match the labels property
Browse files Browse the repository at this point in the history
  • Loading branch information
joemaller committed Feb 17, 2024
1 parent 0c5060c commit 045ce2e
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/Rename.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
}
Expand Down

0 comments on commit 045ce2e

Please sign in to comment.