That sent me in the right direction. Here is what I have came up with. I decided to create a shortcode so I can drop this anywhere needed. Using the get_page_by_title() also allowed me to find posts even if their post type was hidden from the traditional search.
function esm_search($atts) {
extract(shortcode_atts(array(
"label_codeword" => 'Codeword',
"label_submit" => 'Submit'
), $atts));
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$error = false;
foreach ($_POST as $field => $value) {
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
$form_data[$field] = strip_tags($value);
}
if( $form_data['codeword'] != "") {
$esmID = get_page_by_title($form_data['codeword'],"","esm" );
if( $esmID ) {
wp_redirect( get_permalink( $esmID ) );
}else{
$result = 'That codeword doesn\'t exist.';
}
}else{
$result = "Please enter a codeword.";
}
}
if( $result != "" ) {
$info = '<div class="info">'.$result.'</div>';
}
$esm_form = '<form method="post" action="'.get_permalink().'">
<div>
<input type="text" name="codeword" id="esm_codeword" size="6" maxlength="6" value="'.$form_data['codeword'].'" />
</div>
<div>
<input type="submit" value="Sumbit" name="send" id="esm_send" />
</div>
</form>';
if($sent == true) {
return $info;
} else {
return $info.$esm_form;
}
}
P.S. I used this tutorial as a template for the code.