$page = get_page_by_title($title)
– this line is failing somewhere, so you should do a check on this to make sure it exists.
Like so:
function the_alt_title($title="") {
$page = get_page_by_title($title);
if (!$page) {
return $title;
}
if ($p = get_post_meta($page->ID, "_x_entry_alternate_index_title", true)) {
$title = $p;
}
return $title;
}
add_filter('the_title', 'the_alt_title', 10, 1);