Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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