Skip to content

Commit b28f0bf

Browse files
Copilotswissspidy
andcommitted
Update menu item get to use default fields instead of all fields
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
1 parent dd15200 commit b28f0bf

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

src/Menu_Item_Command.php

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function ( $item ) {
132132
* : Instead of returning the whole menu item, returns the value of a single field.
133133
*
134134
* [--fields=<fields>]
135-
* : Limit the output to specific fields. Defaults to all fields.
135+
* : Limit the output to specific fields. Defaults to db_id, type, title, link, position.
136136
*
137137
* [--format=<format>]
138138
* : Render output in a particular format.
@@ -207,27 +207,6 @@ public function get( $args, $assoc_args ) {
207207
// @phpstan-ignore property.notFound
208208
$menu_item->link = $menu_item->url;
209209

210-
if ( empty( $assoc_args['fields'] ) ) {
211-
$assoc_args['fields'] = [
212-
'db_id',
213-
'menu_item_parent',
214-
'object_id',
215-
'object',
216-
'type',
217-
'type_label',
218-
'title',
219-
'url',
220-
'link',
221-
'description',
222-
'attr_title',
223-
'target',
224-
'classes',
225-
'xfn',
226-
'menu_order',
227-
'position',
228-
'post_type',
229-
];
230-
}
231210
$formatter = $this->get_formatter( $assoc_args );
232211
$formatter->display_item( $menu_item );
233212
}

0 commit comments

Comments
 (0)