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.

    '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!



if you want to customise the links in the backend list, you can use this filter :

add_filter("post_row_actions", function ($actions, \WP_Post $post) {

    if ("custom_post_type_slug" === $post->post_type) {

        // modify a existing action or add a new in $actions

        $actions["other link"] = "<a href=\"url\">other link</a>";


    return $actions;

}, 10, 2);

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.