That’s not how that hook is meant to be used:
do_action( 'delete_post', int $postid, WP_Post $post )
https://developer.wordpress.org/reference/hooks/delete_post/
The action gives you the post ID and a post object.
So don’t access $_GET
or the global $post
object, instead use the what the action gives you.
Related Posts:
- How to use “Add link” pop up for a WordPress widget
- How to get all posts related to particular category name?
- Add tag to post api wordpress
- Add a new post status in the post progression
- How to add a quicklink to the Posts Admin Published|Scheduled|Trash menu
- How to show list of posts by author and category?
- Getting the Next and Previous Posts Titles in the Sidebar?
- Email admin when post pending?
- 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
- how to limit and display tag?
- Adding Multiple Values to a Post Meta Key
- Warning: Creating default object from empty value in … /post.php
- get custom image size
- Does an article (post) id ever change?
- Display page content AFTER a loop of posts
- How to get the date of a post in WordPress, so I could use it in a script?
- 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
- Batch process: remove first image from post content
- 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
- Posts with multiple authors with different roles
- How to get the user meta data for a post?
- 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
- Auto insert More tags in all posts
- I can’t format text in th edit page (or posts) whats wrong..?
- “more” tag doesn’t appear when browsing category achives or search
- How to exclude latest x posts from a paginated query?
- Default to ‘all’ view on the ‘edit-post’ screen for authors
- I have a site where attachments in the wp_posts table have guid values of guid, how did this happen?
- Auto Filling Post fields
- WP Admin register taxonomy and post type performance
- How to get the last selected media alignment setting?
- Send post id through ajax and get the post content back
- WordPress Sidebar menu for posts based on date – guidance needed
- How to make multiple sections in home pulling posts category wise?
- 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]
- Update Post Meta is adding a value to my serialize array
- 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?
- Intercept page request and add value to it
- How to display post title inside thumbnail?
- HTML Form Submit to table in same page
- Call current post URL in ajax
- Banner appearing on Pages but not Posts; call it conditional confusion
- Single post full screen template not inheriting WordPress role permission
- how do I get the title in the post [closed]
- 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]
- Have posts included on a page that share same category
- displaying the categories post
- 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
- Pinterest button shows image options from different posts
- 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)?
- Update user meta when post published no working
- Posts are not showing up on next page.
- Custom layout manager for posts
- Get posts by category or author
- How to make post button to a random post
- How can I have the posts from one word press blog show on the presentation page of another word press site
- Where is object, property or label in the database that controls the order of the posts being displayed?
- My posts section for logged in user
- Display the popular tags by default in the backend post edit page (without having to click on the link that displays them) [closed]
- How to get single post by one author?
- Latest posts on all pages
- 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 show only the date, the title and a little “summary” of my WordPress post in my custom theme?
- Permalink remain the same on each page
- wordpress show category link instead of post link [closed]
- Output number of WordPress posts remaining until a post milestone is reached