Skip Navigation

[Resolved] Shortcode toolset-edit-post-link

This support ticket is created 5 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by Mukesh 5 years, 7 months ago.

Assisted by: Waqar.

Author
Posts
#1254653

I have a View where I loop through posts (Custom Post Type) and I use the toolset-edit-post-link shortcode to show a link for each post so that User can edit it from Front End. Here is the entire shortcode:
[toolset-edit-post-link layout_slug="bucket-5-record-payment"]Record Payment |[/toolset-edit-post-link]

I also have a custom post status Registered. Called 'Closed'. Some of the posts are set to Closed.

For posts that have Post Status of Publish I see the Record Payment link but for the posts with "CLosed" custom post status I don't see the link. So my question is does the toolset-edit-post-link only work on Posts with Publish/Draft/Private/Future (internal WordPress Post Statuses)? How can we make it work with Custom Post Statuses?

#1254973

Hi Mukesh,

Thank you for contacting us and I'll be happy to assist.

Your observation is correct and by default, the [toolset-edit-post-link] shortcode, only generates the edit link based on actual/published URL, for the posts with "Publish" status posts.

Note: For the other built-in posts statuses ( e.g. 'future', 'draft', 'pending', 'private' ), it generates an edit link that uses the post's preview URL.

If any custom post status is registered, no edit link is generated for posts which have that status, unless "toolset_filter_edit_post_link_publish_statuses_allowed" or "toolset_filter_edit_post_link_extra_statuses_allowed" filter is used.

Examples:

1. For "Publish" type custom post status "closed":


function example_callback( $allowed_post_types, $form_id ) {
    
    $allowed_post_types = array( 'publish', 'closed' );

    return $allowed_post_types;
}
add_filter( 'toolset_filter_edit_post_link_publish_statuses_allowed', 'example_callback', 10, 2 );

2. For "non-Publish" like custom post status "closed":


function example_callback( $allowed_post_types, $form_id ) {
    
    $allowed_post_types = array( 'future', 'draft', 'pending', 'private', 'closed' );

    return $allowed_post_types;
}
add_filter( 'toolset_filter_edit_post_link_extra_statuses_allowed', 'example_callback', 10, 2 );

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1260651

My issue is resolved now. Thank you!