Skip to content

Instantly share code, notes, and snippets.

@grok
Created April 30, 2014 03:35
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
This is a really lame way to get the WordPress Post ID when on the administration screen.
<?php
// ...
// This should NOT be this difficult ... but at the moment it's what we have.
private function _get_admin_post_id()
{
return absint(isset($_GET['post']) ? $_GET['post'] : (isset($_POST['post_ID']) ? $_POST['post_ID'] : 0));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment