You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The wp menu item command allows for adding links to pages, links to posts and custom links, but doesn't allow for adding links to post type archive pages.
Please could this be added?
E.g. wp menu item add-archive
Thanks.
The text was updated successfully, but these errors were encountered:
The current items match what the default admin backend provides:
I don't think we need to limit ourselves to that, but if we go beyond "out-of-the-box" functionality, we should discuss what the scope we want to support should be. Just adding one random extension seems to arbitrary to my taste.
For now, I wonder whether we should just add a --relative flag to the menu item add-custom variant. This would allow for easy adding of the above archive pages, as well as many other types of links.
As an example, to add the CPT archive of a post that has a slug of books, we could use the following syntax:
wp menu item add-custom --relative my-menu "My Books" books
The --relative flag would let WP-CLI turn books into https://my-domain.com/books.
I don't think we need to limit ourselves to that, but if we go beyond "out-of-the-box" functionality, we should discuss what the scope we want to support should be. Just adding one random extension seems to arbitrary to my taste.
FWIW Post type archive menu links are natively supported in WordPress (show_in_nav_menus option when registering a post type).
FWIW Post type archive menu links are natively supported in WordPress (show_in_nav_menus option when registering a post type).
Moreover they are supported by the wp_update_nav_menu_item function. You can set the menu-item-type to post_type_archive and the menu-item-object to the post_type (e.g. post).
The
wp menu item
command allows for adding links to pages, links to posts and custom links, but doesn't allow for adding links to post type archive pages.Please could this be added?
E.g.
wp menu item add-archive
Thanks.
The text was updated successfully, but these errors were encountered: