Here’s a simple example that redirects to the edit posts screen. Since what you’re asking for is how to get the post, I’m not bothering with messages or particular redirect pages or other variables – though note that wp_die() will just kill the page. In my tests, it just gets you a blank one.
Anyway, I think the two things you need are the load-(page) hook and the ID from the $_GET variable when editing posts:
add_action( 'load-post.php', 'redirect_post_x' ) ;
function redirect_post_x() {
//if post ID = 99999: ID not cast as int here
if ( $_GET[ 'post' ] === '99999' ) {
wp_redirect( admin_url( 'edit.php' ) );
exit;
}
}
Related Posts:
- Get page ID of page that is set as the posts page
- How To Disable (or Remove) “All Posts, Published, and Trash” in Dashboard Posts
- Are post ID’s reliable?
- Get current post id in functions.php
- get all posts ID from a category
- Get the current post ID as a variable in Javascript
- Is post ID number always incremental n+
- How to Arrange Posts by Size in the WordPress Dashboard?
- Are all ID’s used unique?
- $post->ID displays wrong ID
- At my posts archive page, outside the loop, get_the_id() returns the top most post’s ID
- Showing random content / pictures from earlier posts in a sticky post?
- Get the post_id of a new post
- Get all posts by post_author
- get post id in while loops outputting page id
- How can I display a specific user’s first published post?
- Undefined variable post_id in custom quick edit coloumn
- Getting post id from wp_insert_post_data function?
- Does an article (post) id ever change?
- How to get the post’s parent ID?
- Can a page_id and a post_id be same?
- Is there a better, more efficient way to get the post id outside the loop?
- Getting current post ID in functions.php
- Buddypress activity id
- How blog page in WordPress works : blog page retrieve first post ID
- Dashboard :10 Last draft page and 10 last pending review page (metabox)
- Post-ID in url differs from $post->ID
- Why is my Blog Page ID == First Post ID?
- WordPress’ ALL post count info on its dashboard does not match phpMyAdmin’s ALL post count!
- current post with current author
- Is it possible to change post id for an already added menu item in WordPress?
- Get ALL post ID’s export list (Only id’s. Php or sql not important )
- How to get next post ID?
- After database migration, posts not showing up in dashboard
- Search results posts_orderby and ID
- remove post and categories/tags count from right now dashboard widget
- Retrieve post ID from “querying” URL
- How to get a post’s content? [closed]
- obtain the author id given the post id
- How to get ID of the page included with get_page()?
- Develop Admin Panel Page
- How to I retrieve the ID from the Posts page?
- Crazy Question – Updating Post ID
- Why I can not I use the variable outside my function?
- How do you change the comment count in the back end posts list, to reflect unapproved comments, rather than all comments?
- retrieve the oldest post id
- WP_Query custom field pass the post id
- Accessing Post ID Within Loop
- How do post IDs work in WordPress?
- Are post, page and category IDs unique to each other?
- The loop starting at a certain ID
- linking to post outside the loop
- Widget to show posts in the sidebar basing on its IDs
- Get a post’s ID
- Making posts permalinks consistent numbers
- How to get post id of last approved comment?
- How to get the post id (of the parent custom custom type) in a loop inside a widget?
- I want to add another search box on posts page in dashboard
- Get post slug and match with menu item slug to change css
- WordPress Post ids big increment
- Reuse old post ID for new post after deleting post
- How to view a post from the wordpress admin screen
- link to edit a post has empty target
- Get post attachment with post id
- Very weird behaviour after removing WP pages
- How to display post excerpt beside post list inside Post of Dashboard
- How can i take all ids from untrash_post action?
- How do I apply a wordpress function to something with no ID inside an archive page?
- Only get post_id [duplicate]
- How to test if user is filtering post list in dashboard
- Hide Admin posts & pages in Dashboard
- Surrogate ID for posts, is there an alternative field in the posts table?
- Is it possible to have dynamic post id # in add_menu_page()?
- Using Post ID and Page ID in same function
- unused post IDs
- Creating / Editing a post from within site template
- How to get override the WP Admin Syndication feed limit for a custom feed?
- find view post hyperlink in PHP wordpress admin file
- Custom post page has attributes of latest post [closed]
- Can I get custom post items in select box (dropdown)
- Allow User Can See His Post on his dashboard
- What is $post->ID
- View post with specific category id and name which I selected in the backend (drop-down option)
- How do I save JS classes being applied to the WP dashboard via custom plugin?
- WordPress shows a count of published items on the site, but the items are not appearing when you click on the “published” link
- How to get post ID after removing that post?
- Why does ‘get_the_ID’ work outside of the loop?
- Get WordPress post content by post id
- Get Posts Under Custom Taxonomy
- How to limit the number of posts that WP_Query gets?
- Stop WordPress Wrapping Images In A “P” Tag
- When is the ‘post_content_filtered’ column in database cleared by WordPress?
- Turn a URL into an Attachment / Post ID
- GET the excerpt by ID
- Stop WordPress automatically adding tags to post content
- Determine if page is the Posts Page
- How to get ‘post_content’ without stripping tags?
- How to add an admin notice upon post save/update
- Print Current Post Index number within Loop
- Should we trust the post globals?