Example URL: mywebsite.com/wp-admin/post.php?post=1234&action=edit
I have found hooks that fire when a post is created/edited/status changed, but nothing that works for just viewing a post.
I need to check some meta data and update it before the post is displayed to the user
I have tried several hooks already but none let me edit post meta at the correct time (when viewing a post)
Solution: Adding this to admin_init allowed me to update post meta for a given post after the post data was loaded
if (isset($_GET['post']) && (isset($_GET['action']) && $_GET['action'] == 'edit'))
{
$post = get_post($_GET['post']);
if ($post->post_type == 'program')
{
// do stuff
}
}
2
Answers
save_post hook in your case
what you are trying to do show your code
Not sure if there’s a hook so you could either add one manually or use something like this