How to change URL for custom post type archive?
I’m trying to change the URL for my custom post type archive.
At the moment, the archive of my post type has the URL https://example.com/myposttype/
I want to change that to https://example.com/xyz/somethingelse/
First I tried to just get it to display https://example.com/somethingelse/, but that doesn’t even work. I thought the rewrite parameter would do this when I register the custom post type.
$args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'menu_position' => 6, 'menu_icon' => 'dashicons-list-view', 'show_in_rest' => true, 'rewrite' => array('slug' => 'somethingelse'), 'supports' => array('title', 'editor', 'thumbnail', 'comments', 'excerpts', 'revisions', 'custom-fields'), 'show_ui' => true, 'show_in_menu' => true, 'query_var' => true, 'has_archive' => 'myposttype' );
rewrite doesn’t seem to do anything. I refreshed the permalinks and went to https://example.com/somethingelse/, but the page can’t be found. Why doesn’t it do, what I want?