Make Only Accessible to Feed URL on a WordPress Si

2019-09-07 05:59发布

I'm wondering if it is possible to write a plugin which shows nothing but only let the visitor access the feed url. The admin page should be accessible by the administrator as well.

The background of this idea is that I've written a custom feed generator and implemented it in a WordPress site. Since the site is only for the feeds, I'd like to make the site invisible to the public except the feed outputs.

I'm aware that there are Maintenance Mode and Members Only plugins. The problem is that the maintenance mode prohibits feed access and the member only mode bans general visitors.

So I'm wondering if there is a simple way to do this. I'd like to avoid editing mod_rewrite because I'm planning to make it as a plugin if possible. If it is not realistic to do it without mod_rewrite, I will try editing mod_rewrite.

Thanks for your input.

2条回答
家丑人穷心不美
2楼-- · 2019-09-07 06:33

If you never want anything to render this could easily be fixed using the template_redirect hook. For example:

function stop_rendering() {
    exit;
}
add_action( 'template_redirect', 'stop_rendering');
查看更多
聊天终结者
3楼-- · 2019-09-07 06:47

So, basically you don't want the theme to render? What about /categories, /tags, /archives etc.?

If that's all you want to do, you could just create a blank theme with the style.css (blank besides the theme info comment block) and the index.php template.

查看更多
登录 后发表回答