0

I've found this documentation about adding terms using WP CLI: https://developer.wordpress.org/cli/commands/menu/item/add-term/ and tried to find out how I can add an existing category to the main-menu, but no luck.

The documentation hasn't got an example of this one or isn't clear enough to me at the moment.

Hopefully anyone else did this one before and can tell me how to accomplish it. I've got now: (but this doesn't work)

wp menu item add-term main-menu category 1

Thanks in advance!

3
  • what WP version are you on? are you using a full site editing theme? Jul 25 at 23:09
  • Latest, WP 6.0.1, WP-CLI 2.6.0. Just a Wordpress theme from the theme library, nothing special with builders Jul 26 at 9:24
  • do a wp menu list to list all the registered menus and make sure you have the Main Menu registered as a menu. I just tested on a new WP instance with the twentytwentyone theme ( no full site editing ) with your exact CLI command: wp menu item add-term main-menu category 1 and it works Jul 26 at 11:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.