Skip to content

Commit 7789f3e

Browse files
Copilotswissspidy
andcommitted
Fix position calculation for menu items with menu_order 0
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
1 parent 6f29afa commit 7789f3e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Menu_Item_Command.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ public function get( $args, $assoc_args ) {
203203

204204
// Correct position inconsistency and protected `url` param in WP-CLI
205205
// @phpstan-ignore property.notFound
206-
$menu_item->position = $menu_item->menu_order;
206+
$menu_item->position = ( 0 === $menu_item->menu_order ) ? 1 : $menu_item->menu_order;
207207
// @phpstan-ignore property.notFound
208-
$menu_item->link = $menu_item->url;
208+
$menu_item->link = $menu_item->url;
209209

210210
if ( empty( $assoc_args['fields'] ) ) {
211211
$assoc_args['fields'] = [

0 commit comments

Comments
 (0)