I just discovered your very useful plug-in and wanted to put it into a site we're currently readying for production. Alas, I found a little bug that hits when the site is using a non-default table prefix.
In the Query (on about line 165) you reference the
wp_posts table directly, as opposed to using
$wpdb->posts. This means that for our site, we always hit 404, without an error explanation. Applying the fix solved it, so we can now have the site up and running soon!