Skip to content

Instantly share code, notes, and snippets.

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