Php WP重写规则筛选器能否查询多个帖子类型?

Php WP重写规则筛选器能否查询多个帖子类型?,php,wordpress,url-rewriting,Php,Wordpress,Url Rewriting,我目前在theme的functions.php中设置了一个简单的重写规则: add_filter('rewrite_rules_array', function($rules) { $newRules = array( '(.+)/?$' => 'index.php?my_post_type=$matches[1]' ); return array_merge($newRules, $rules); }); 我还将永久链接设置为默认设置: C

我目前在theme的functions.php中设置了一个简单的重写规则:

add_filter('rewrite_rules_array', function($rules) {
    $newRules  = array(
        '(.+)/?$'   => 'index.php?my_post_type=$matches[1]'
    );
    return array_merge($newRules, $rules);
});
我还将永久链接设置为默认设置:

Custom Structure: /%postname%
重写工作应该是完美的。不过,我的问题是:

如果在“我的帖子类型”帖子类型中找不到匹配的帖子,是否可以允许此重定向规则默认为“页面”帖子类型?

据我所知,重写规则只查找指定的post类型,然后在未找到时返回404。我仍然想要404,但前提是(按顺序)“my_post_type”和“page”post类型都没有包含该slug的帖子

我搜索并找到了一些替代(黑客)解决方案,但找不到一个最近的或非常相关的问题。谢谢