From 1603a0b324f1e3e8a5056df7c2430747bd9f33bd Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sun, 15 Mar 2026 07:45:10 +0000
Subject: [PATCH 1/4] Initial plan
From f26bdbd5efdf6026beeaf4a8165ab451e7e456dd Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sun, 15 Mar 2026 07:48:13 +0000
Subject: [PATCH 2/4] Add wp menu item add-post-type-archive command
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
---
features/menu-item.feature | 21 ++++++++++++++
src/Menu_Item_Command.php | 57 ++++++++++++++++++++++++++++++++++++++
2 files changed, 78 insertions(+)
diff --git a/features/menu-item.feature b/features/menu-item.feature
index 494e0dfd0..cbaceae3c 100644
--- a/features/menu-item.feature
+++ b/features/menu-item.feature
@@ -252,3 +252,24 @@ Feature: Manage WordPress menu items
"""
And the return code should be 1
+ Scenario: Add a post type archive as a menu item
+
+ When I run `wp menu create "Archive Menu"`
+ Then STDOUT should not be empty
+
+ When I run `wp menu item add-post-type-archive archive-menu post --porcelain`
+ Then STDOUT should be a number
+ And save STDOUT as {ITEM_ID}
+
+ When I run `wp menu item list archive-menu --fields=db_id,type,object`
+ Then STDOUT should be a table containing rows:
+ | db_id | type | object |
+ | {ITEM_ID} | post_type_archive | post |
+
+ When I try `wp menu item add-post-type-archive archive-menu invalidposttype`
+ Then STDERR should be:
+ """
+ Error: Invalid post type.
+ """
+ And the return code should be 1
+
diff --git a/src/Menu_Item_Command.php b/src/Menu_Item_Command.php
index 40bf6610b..8f3e44781 100644
--- a/src/Menu_Item_Command.php
+++ b/src/Menu_Item_Command.php
@@ -329,6 +329,63 @@ public function add_term( $args, $assoc_args ) {
$this->add_or_update_item( 'add', 'taxonomy', $args, $assoc_args );
}
+ /**
+ * Adds a post type archive as a menu item.
+ *
+ * ## OPTIONS
+ *
+ *