munyaguさん、返信ありがとうございます!
勘違いすることが多いので、こちらに投稿してご意見いただければうれしいなと思っていたので返信いただけて心強く思いました。
たぶん
$lastpostdate = get_lastpostdate( $timezone );
if ( $lastpostdate > $lastpostmodified ) {
$lastpostmodified = $lastpostdate;
}
を
$lastpostdate = get_lastpostdate( $timezone , $post_type);
if ( $lastpostdate > $lastpostmodified ) {
$lastpostmodified = $lastpostdate;
}
とすれば、制作した方の意図通り(更新日より投稿日の方が大きいものがあれば返す)にカスタム投稿タイプのときもなると思いました。コードを修正して確認したところそのように動作しました。
英語の説明が難しいので この行をこうすると意図通りになるのでは?的に書いてみようと思います。