Skip to content

MenuItem Copy & Paste v1.1.3

Latest

Choose a tag to compare

@sarap422 sarap422 released this 01 Jun 03:26

MenuItem Copy & Paste v1.1.3

WordPress Plugin Version
WordPress Plugin: Tested WP Version
WordPress Plugin Required PHP Version
WordPress Plugin Downloads
WordPress Plugin Rating
GitHub release (latest by date)
License: GPL v2
GitHub last commit

Copy, paste, clone, delete and collapse menu items, duplicate whole menus, export/import menus as JSON, and use shortcodes in menu items — all from the WordPress menu editor.

📥 Download from WordPress.org | 📖 Documentation | 🐛 Report Issues


✨ Features

Per-Item Buttons

Six quick action buttons are added to each menu item:

  • ➕ New: Instantly create a new custom link below the selected item
  • 📒 Clone: Duplicate the item immediately below itself
  • 🔗 Copy: Copy item data to clipboard with visual highlight (blue background)
  • 📋 Paste: Paste the copied item below any target item
  • 🗑️ Delete: Remove the item without opening its accordion — with confirmation dialog
  • ▲▼ Collapse: Fold/unfold all child items under a parent (state saved in localStorage)

Menu-Level Tools

Controls added to the menu editor header:

  • 🗂️ Duplicate Menu: Clone an entire menu (hierarchy preserved) with one click next to "Save Menu"; auto-named {name}_copied
  • ⬇️ Export Menu: Download the selected menu as a JSON file (top-right "Export Menu")
  • ⬆️ Import Menu: Rebuild a menu from a JSON file as a new menu (top-right "Import Menu"); pages and categories are re-resolved by slug on the target site — ideal for migrating template menus across sites

Shortcode Support

  • 🧬 Shortcodes in menu item URL, navigation label, and description are executed on the front end — no extra metabox needed; theme-defined shortcodes are supported

📸 Screenshots

Six buttons — Clone tooltip visible
Six quick action buttons on each menu item (New / Clone / Copy / Paste / Delete / Collapse)

Copied item highlighted in blue
The copied item is highlighted in blue so you always know what's on the clipboard

Delete confirmation dialog
A confirmation dialog prevents accidental deletions

Collapse tooltip visible
The Collapse button folds all child items under a parent — great for navigating large menus

Duplicated menu named _copied
"Duplicate Menu" clones the entire hierarchy and names it {original}_copied automatically

Export Menu — JSON downloaded
"Export Menu" exports the current menu as a JSON file with one click

Import Menu — file picker
"Import Menu" opens a file picker to select a previously exported JSON file

Imported menu restored
The imported menu is created as a new menu with the full hierarchy restored


📥 Installation

From WordPress.org (Recommended)

  1. Go to WordPress Admin → Plugins → Add New
  2. Search for "MenuItem Copy & Paste"
  3. Click "Install Now" and then "Activate"
  4. Go to Appearance → Menus to start using the new buttons

Manual Installation

  1. Download the latest release from the releases page
  2. Upload the plugin files to /wp-content/plugins/menuitem-copy-paste/
  3. Activate the plugin through the Plugins menu in WordPress
  4. Go to Appearance → Menus to start using the new buttons

From GitHub

cd /path/to/wordpress/wp-content/plugins/
git clone https://github.com/sarap422/wp-plugin-menuitem-copy-paste.git menuitem-copy-paste

Then activate the plugin through the WordPress admin panel.


🔧 Requirements

  • WordPress: 5.0 or higher
  • PHP: 7.4 or higher
  • Tested up to: WordPress 6.8

❓ Frequently Asked Questions

Which WordPress versions are supported?

WordPress 5.0 or higher. Tested up to the latest version (6.8).

Can deleted items be restored?

A confirmation dialog appears before deletion. Once deleted, items cannot be restored. However, if you haven't clicked "Save Menu" yet, you can reload the page to revert all unsaved changes.

Can I paste a copied item into a different menu?

Yes. Copy an item, switch to another menu, then click Paste on any item there.

What are the default values for items created with the New button?

Title: New Custom Link, URL: /. Edit them by opening the item's accordion after creation.

Can I copy child menu items?

The Copy and Clone buttons act on a single item only, excluding its children. To duplicate an entire menu with its hierarchy intact, use the Duplicate Menu button next to "Save Menu".

How does the Collapse button work?

Parent items that have children show a ▲/▼ toggle at the right end of the button group. Click it to fold or unfold all descendants. The collapsed state is saved per-menu in localStorage and restored on page reload. Items without children do not show the toggle.

Will collapsing items break drag & drop?

No. Dragging a collapsed parent auto-expands it first so its children move together. After the drag, the toggle visibility is re-evaluated based on the updated hierarchy.

How does Export / Import work?

Export: Click "Export Menu" (top-right of the menu editor) to download a JSON file of the current menu.
Import: Click "Import Menu", select a previously exported JSON file, and a new menu will be created. Pages and categories are re-resolved by slug on the target site, so the menu migrates correctly even across different WordPress installations.

How do shortcodes work in menu items?

Any shortcode in a menu item's URL, navigation label, or description is executed on the front end when the menu is rendered. No extra configuration is needed; just type the shortcode directly into the field.


📝 Changelog

1.1.3 (2026-06-01)

  • 🛡️ Resilience: the plugin now verifies its required includes/ files exist before loading. If any are missing, it shows an admin notice and stops safely instead of causing a site-wide fatal error.

1.1.2 (2026-06-01)

  • 🛠️ Packaging fix: the includes/ directory and js/menuitem-menu-tools.js were missing from the published WordPress.org package, causing a fatal error on activation. Re-published with the complete file set. No code changes.

1.1.1 (2026-05-28)

  • 🧬 Added Shortcode support in menu item URL, navigation label, and description
  • 🗂️ Added Duplicate Menu: clone an entire menu (hierarchy preserved); auto-named {name}_copied
  • ⬇️ Added Export Menu: download the current menu as a JSON file
  • ⬆️ Added Import Menu: rebuild a menu from JSON; pages/categories re-resolved by slug for cross-site migration
  • 🏗️ Refactored into includes/ (bootstrap + item-actions / shortcode / tools / builder classes)

1.0.7 (2026-05-20)

  • ▲▼ Added Collapse: fold/unfold child items under any parent
  • 💾 Collapse state persisted per-menu in localStorage and restored on page reload
  • 🧲 Auto-expand parent before drag so children move together
  • 🎯 Toggle button auto-shows/hides based on whether the item has children
  • 📐 Adjusted button container width to accommodate the sixth button

1.0.6 (2025-11-04)

  • ➕ Added New: instantly create a custom link below the selected item
  • 📒 Added Clone: duplicate the item immediately below
  • 🗑️ Added Delete: remove items without opening the accordion
  • 🎨 Added visual highlight (blue background) for copied items
  • 🔒 Enhanced security: strengthened $_POST variable validation
  • ✅ Improved code quality: compliance with WordPress Coding Standards

1.0.4

  • Added accurate position calculation respecting hierarchical structure
  • Implemented recursive descendant retrieval

1.0.3

  • Initial release — menu item copy & paste functionality

View full changelog →


🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the GPL v2 or later — see the LICENSE file for details.


🔗 Links


💖 Support

If you find this plugin helpful, please:


Made with ❤️ by sarap422