There are two questions here. For styling alerts/modals, that’s a generic HTML/CSS question – check out these to get you started.
For the second, it depends what you’re doing after the delete – are you redirecting back to the frontend, or staying in the admin? (I will update my answer following your response).
You shouldn’t be reinventing the wheel – use the core function get_delete_post_link
to get the delete URL. This will handle nonces and any future changes to core, if and when they occur.
Update: For your redirect, add a param that you can then check for on page load:
$redirect = add_query_arg( 'success', 'true', $redirect );
And then in your template file:
if ( ! empty( $_GET['success'] ) ) {
echo 'Wahey!';
}
Related Posts:
- Keyboard shortcut for updating a page or post?
- Ajax Load More Posts in Category Page
- Get the current post ID as a variable in Javascript
- How to create WP Editor using javascript
- Dynamically update post title in admin page
- Add javascript when post is published
- Get post from custom REST endpoint in Gutenberg
- Add confirmation popup on “Move to Trash”
- Create a separate JS application for an individual post?
- Convert a complex webpage into WP theme
- Add scripts on custom post add/edit pages Not Working
- Injecting JavaScript into a Post with WP3.x
- How can I get a post field value using javascript?
- Custom post preview without saving
- Block Editor: Reset Reusable Blocks to last saved record
- Ajaxify This Code
- Integrate OpenStreetMap on WordPress
- Only show a Post once in 10 visits
- In post.php how can I remove onbeforeunload?
- Navigate through the posts using keyboard arrows
- Call current post URL in ajax
- Get content from WordPress posts in Boostrap modal window – Javascript side?
- Insert specific information to a posts of a predefined category
- WordPress as CMS: How to manage/handle images assigned to a post as full-sized background images in a slideshow?
- Using the loop to set locations for all posts on a single google map
- Insert JavaScript in a blog post or a new page?
- Why is it recommended to insert JS through the theme, plugin, etc rather than in the post directly?
- WordPress React re-rendering to many times
- Ajax post doesnt call succes after got the response
- Blog Post slider not working
- Colorbox not working on native WordPress gallery when gallery is loaded thru AJAX
- testing result of $.post with json_encode
- Loading posts outside wordpress
- How to hide a script ( an ad) from a specific post? [closed]
- WP Rest API feature image breaking react component
- How can I add a custom caclulation form in post?
- How do I save JS classes being applied to the WP dashboard via custom plugin?
- How to get post creation date?
- Confirmation box when submitting post for review
- Insert custom div between posts
- How to Display Post View Count
- Remove double space after a period
- Displaying the number of posts in a custom loop (without including the number of posts of a loop below)?
- display order of connections
- Conditional that checks if a current category has any subcategory with posts
- How to get the date of a post in WordPress, so I could use it in a script?
- Unwanted Duplicate Posts Showing in Pagination Pages
- Downgrade user from role that allows post creation
- How to store an extra (surrogate) ID when creating a post with wp_insert_post?
- Add code just after Post content
- Alternating post layout
- Articles are text-only in any “Category” instead of HTML
- How to get the user meta data for a post?
- Auto insert More tags in all posts
- Get current category id from post page wordpress
- How to change post status from frontend?
- How to show last post of each website of a MU wordpress in HomePage
- Retrieve value between 2 post
- How to display content from the main blog on another from multisite network as it would be its own
- After database migration, posts not showing up in dashboard
- how to replace source ” https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css” in the wordpress backend?
- Display an author’s posts on his own author page
- Static posts page with home.php
- Start WP Pagination From Number 1 in URL
- Avoiding “Missed Schedule” errors when inserting future posts
- Using setup_postdata() with multi-dimensional array
- Deleting post specific content at beginning of post
- How to display the requested post only?
- Export all posts to import as product items
- Prevent duplicate pages from being added
- Can I style single post that are in multiple catergories?
- Older blog posts not showing up on WordPress
- Embedding Post Editor Into External Site
- Show single post child category from a determined parent
- Pagination Stops
- How to mark only one post as Featured post?
- Remove status ‘archived’ from the default post and page view
- How to invoke a HTML custom button based on a HTML dropdownlist menu
- Custom Post Types and Broken Permalinks
- The first post appears twice
- how to call recent post content in a loop ( only the content before read more tag)
- Find post tags words in post content and link them to tag URLs
- How can I filter the post of a CPT by taxonomy Term in admin meta-box dropdown?
- Show Posts By Custom Field
- Hide title in Merlin Theme on posts and pages only
- Post as frontpage – avoid duplicate content
- Blog styling in SASS
- Is there a way to change the complete URL of the blog post for a redirecting tracking link?
- WordPress with static posts page and custom permalink structure doesn’t find posts with numeric permalinks
- My posts section for logged in user
- Preview own posts if logged in
- Pagination for custom query won’t let me back on page 1
- Displaying warning if no featured image has been set – Post Editor
- How to highlight most recent posts in a list
- wordpress show category link instead of post link [closed]
- CSS – Change height of Storefront / WooCommerce product categories, but not products
- How to add a new page that will function as a separate blog/news article page
- Making a private post visitable by link?
- Display content from specific category
- Batch Scanning and Deleting Empty WordPress Posts