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?
- WordPress custom post_status after 6.6 version
- How do you add thumbnail support for custom post types?
- How To Have Two Gutenberg Editors On One Post?
- Verify if tag is used on posts
- getting video dimensions
- Display posts for a single post format
- Overview with latest edited posts and pages
- deleting terms programmatically
- posts_per_page doesnt work
- if I create ‘front-page.php’, then how do I link to post index?
- Check to see if post is live before displaying the content
- Ajax posts filter by date, comments, top views, top likes
- Copying and pasting emoji in a wordpress post
- How to automatically apply a category based on the post title?
- Get latest posts from WordPress site without header, menu and sidebar
- How can I schedule a PAGE to go live at a future date/time?
- Counter of posts ever posted – even deleted ones
- How to delete all the content of a wordpress site without deleting the Post and pages?
- Most liked page not displaying posts
- WordPress’ ALL post count info on its dashboard does not match phpMyAdmin’s ALL post count!
- Update a users role based on number of posts published
- Style Differently Edited Posts
- 404 on paginated blog pages
- Blog page pagination is not working after using the offset argument
- Search results posts_orderby and ID
- Conditional Tag for has post [closed]
- Update Post Meta is adding a value to my serialize array
- Is it possible to filter the main loop to exclude posts from a specific category?
- Hide a specific post from a page template
- How to change the layout of posts when viewing all posts by tag [closed]
- Intercept page request and add value to it
- HTML Form Submit to table in same page
- Single post full screen template not inheriting WordPress role permission
- How to select particular month post from table and update the post status using MySQL?
- how many visitor open this post? [closed]
- Have posts included on a page that share same category
- displaying the categories post
- Preview page/post revisions without overwriting current content
- While loop in functions.php outputting the_title() of each post on frontpage
- Execute php after post save/update
- Add CSS and JS files of the template post on a WordPress page
- Is there a way to save different data when USER interacts with the same POST?
- New Post bubble
- Prevent Archive URLs
- Dev and prod on the same database- dev version active for IOS
- show only one category and filter by tag
- How can I exclude only a specific sub category post from category display?
- Update user meta when post published no working
- Posts are not showing up on next page.
- Custom layout manager for posts
- Export Posts with specific custom fields by sql
- Function/filter or plugin to change post status based on custom field value
- Gallery just showing plain short code like [gallery ids="240,236,275"]. how to solve this?
- How do I paginate posts page with $wpdb?
- WP_Query retrieve custom posts but not the post showing
- How to handle dates, trying to calculate time since a post
- How to Post to Specific Pages?
- Post thumbnail is not shown in wp-admin
- How to have more post in a page than in your home page
- Exclude a ‘portfolio’ custom category?
- Display a custom field rating system in the front end
- Allow User Can See His Post on his dashboard
- How to delete posts with incorrect status