Simply replace
wp_delete_post( get_query_var( 'postid1'), true );
with
wp_update_post( array( 'ID' => get_query_var( 'postid1' ), 'post_status' => 'draft' ) );
That is assuming that the rest of your logic does already work.
Related Posts:
- Front-End Post Submission
- How to upload post thumbnail while wp_insert_post?
- Publish pending article from front end with a button?
- Get names of authors who have edited a post
- Edit a post from frontend. post_tags get saved, but not separated
- Developing a secure front end posting form
- How can I edit a post from the frontend?
- Developing a secure front end post editing form
- Post from front-end only by logged in users, form posts as “posted by:
- upload featured image from front end using wordpress add media button
- Post & edit a post from front end along with upload, dropdown, and other inputs
- Frontend Post Excerpt field mapping
- Frontend Post Form Validation
- Redirection not working in this front end post submission form?
- How to change the color theme per post?
- Adding an image to a non existing post
- How to make a bilingual front-end post using the plugin WP User Frontend and Polylang or qTranslate?
- 404 error on default post type and default taxonomy fronted page
- Lock post editing to one user at a time – wp_check_post_lock
- Front end post submission form with duplicate type fields
- Replace image name on upload to the new post name on front-end form
- Edit the post title from the frontend
- Can i have more than one form for front end posting in one template [closed]
- Get Users Post ID
- WordPress wp_editor to post and edit
- How to limit post (Exception pages) for current user in each role in front end?
- Create posts by any logged in users
- How to generate an HTML link automatically from URL in a users’ post
- how let users select categories for posts in frontend?
- Allow reader to reorder posts for themselves (oldest first)
- Send the post id to a front end edit post form
- Post/Edit/Delete Post From Frontend… How?
- Send/Publish a Post front end
- How Can I Limit Users to Post Creation For My Frontend Theme?
- User driven content problems
- Create post from form with image
- Stop Authors from submitting spam post
- How to use “Add link” pop up for a WordPress widget
- How to get all posts related to particular category name?
- Add a new post status in the post progression
- How to add a quicklink to the Posts Admin Published|Scheduled|Trash menu
- Getting the Next and Previous Posts Titles in the Sidebar?
- How to control which category will be picked for the slug of a post?
- How to hide the Text Area in the Post Edit screen
- upload image in a meta box
- Search posts by post author name
- Why is our post editor stuck at cols=40?
- Adding a Nav menu to post admin
- get custom image size
- Does an article (post) id ever change?
- Check is_single() outside loop
- Only display a certain number of posts, dependent on how many posts there are available in a query
- how to replace embedded “full” sized images within a post with the “large” ones
- Change default Posts page
- Create post for every user?
- Facebook Share Thumbnail
- Yearly archive page for future year
- How blog page in WordPress works : blog page retrieve first post ID
- Delete WordPress posts from URL list sql query
- Custom WordPress Theme: Publish Date and Display Date for posts right beside each other
- How to change permalink on post click on post listing page
- Blog post per page setting conflicting with custom WP_Query?
- Show certain posts in a LIST format that members have been granted access to
- WordPress Rest API Create Post
- performance of post_exists
- Add a custom meta box in the post options that loads some html code in the header
- Permalink doesn’t get displayed in Twitter button (Local WordPress problem?)
- Highlight static blog page link in header
- wp_insert_post_data: Limit number of Page but Post get affected
- Conditional Tag for has post [closed]
- Possible to add a statement to a core file?
- older blog posts not showing in new theme
- Is there any way to stylize articles one by one?
- How to display post title inside thumbnail?
- Single post full screen template not inheriting WordPress role permission
- Publish a Silent Post without updating Feed
- Open a wordpress single post in a lightbox without the header and footer
- how many visitor open this post? [closed]
- Separate top level categories on archive-product.php by meta
- How to add text before post_excerpt in Gutenberg
- While loop in functions.php outputting the_title() of each post on frontpage
- Execute php after post save/update
- Ignore posts content in the posts queries for internal linking
- Many buttons not functioning in WordPress dashboard (as admin)
- Is there a way to save different data when USER interacts with the same POST?
- Fill the exclude array() in get_posts()
- Prevent Archive URLs
- Dev and prod on the same database- dev version active for IOS
- Prevent WordPress from putting around specific element
- How to correctly escape data
- How to fetch posts that are stored in the different table than the default table (wp_posts)?
- Custom layout manager for posts
- How to make post button to a random post
- Where is object, property or label in the database that controls the order of the posts being displayed?
- How to get single post by one author?
- Getting 404 when using rewrite rule for posts
- Posts and pages not getting published
- How to create a post based on data in a table?
- Display all posts from selected month
- how to change background color of my all post