Skip to content

Instantly share code, notes, and snippets.

@kastner
Created January 15, 2009 23:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kastner/47701 to your computer and use it in GitHub Desktop.
Save kastner/47701 to your computer and use it in GitHub Desktop.
<?php
require( './wp-load.php' );
$episode = intval($_REQUEST["episode"]);
$post_id = $wpdb->get_var($wpdb->prepare("select post_id from wp_postmeta
where meta_key = 'episode' and meta_value=%d", $episode));
if ( $permalink =& get_permalink( $post_id ) ) {
Header("Location: $permalink");
}
else {
echo "Can't find that post";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment