I have created custom post types that use custom endpoints to load the correct template based upon the content the user is viewing.
I created custom Admin Toolbar menu items.
$wp_adminbar->add_node([ 'id' => 'svcta-view-directory-hotel', 'title' => 'Launch Hotel View', 'href' => home_url('/directory/hotels/SLUG/stay'), 'meta' => [ 'target' => 'blank' ] ]);
In home_url('/directory/hotels/SLUG/stay') – How can I pull the slug of the current custom post type entry being edited?
For example, when I edit this entry: http://svcta.lainternet.biz/directory/micah-test-all/stay/
The standard “View Listing” link goes to http://svcta.lainternet.biz/directory/micah-test-all/ - This is broken because it doesn’t load the custom endpoint “/stay/”.
I need a new custom link that will open a new tab and show this Custom Post Type entry on the correct “/stay/” endpoint.
I searched for a few hours and couldn’t find any solutions.
Thanks for the help!