Hi Andrei,
Thank you for waiting.
I've performed some tests and here is a workaround that you can use, to delete the post from the front-end, without reloading the page and exposing the link with path "/wp-admin/admin-ajax.php".
1. Please create a new post form and set it to "Edit existing content" and select the post type that is being shown in the view.
( ref: https://toolset.com/documentation/getting-started-with-toolset/publish-content-from-the-front-end/forms-for-editing/ )
Also, check the option "Submit this form without reloading the page (use AJAX)" in the form's settings, so that the page is not refreshed.
Screenshot: hidden link
2. This form doesn't need to have any front-end visible fields other than the submit button and an HTML content, that will hold the content that you're showing for a single loop item in the view.
Screenshot: hidden link
3. In the view's loop item content template, you can insert the shortcode for this new edit form, because now the repeating content for each post will need to be shown from inside the editing form.
[cred_form form='slug-of-the-form']
This will ensure that when the form will be submitted to delete the post, its content is also removed from the page.
4. The last step would be to add a special function, attached to the hook "cred_submit_complete", which deletes the post, for which the form is submitted.
( ref: https://toolset.com/documentation/programmer-reference/cred-api/#cred_submit_complete )
add_action('cred_submit_complete', 'custom_post_delete_function',10,2);
function custom_post_delete_function($post_id, $form_data)
{
// if a specific form
if ($form_data['id']==1234)
{
wp_delete_post( $post_id, true );
}
}
Please replace "1234" with the actual ID of the form created in step 1.
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar