only delete post within query / for each statement (front end)
You should pass in the id of the post you want to delete as an argument of the delete_post() function rather than relying on obtaining it via global $post within the function itself: <?php echo delete_post($section->ID); ?> Then in your delete_post() function you can use the passed-in argument like so: function delete_post($sectionid){ $deletepostlink= add_query_arg( ‘frontend’, … Read more