plugins - How to direct wordpress traffic to specific page

I have a page created in wordpress that I want to redirect all users to. Ex.: www.mywordpressofflineHow can I direct al

I have a page created in wordpress that I want to redirect all users to. Ex.: www.mywordpress/offline

How can I direct all traffic requests (except wp-admin and dashboard) to this page?

My goal is to have an offline page for when I am working on things or I am not accepting any new business.

I have a page created in wordpress that I want to redirect all users to. Ex.: www.mywordpress/offline

How can I direct all traffic requests (except wp-admin and dashboard) to this page?

My goal is to have an offline page for when I am working on things or I am not accepting any new business.

Share Improve this question asked Oct 4, 2019 at 5:46 stevensteven 1
Add a comment  | 

2 Answers 2

Reset to default 0

Check this plugin - https://wordpress/plugins/jf3-maintenance-mode/

This plugin is intended primarily for designers / developers that need to allow clients to preview sites before being available to the general public or to temporarily hide your WordPress site while undergoing major updates.

You can use template_redirect action for redirect all user to specific page. paste this code in functions.php of active theme and just change page slug offline with your page slug where you want to redirect. when non logged user visit any page of site it will redirect to specific page.

add_action( 'template_redirect', 'redirect_to_specific_page' );
function redirect_to_specific_page() {
    if ( !is_page('offline') && ! is_user_logged_in() ) {
        wp_redirect( home_url()."/offline/" ); 
        exit();
    }
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745107073a4611623.html

相关推荐

  • plugins - How to direct wordpress traffic to specific page

    I have a page created in wordpress that I want to redirect all users to. Ex.: www.mywordpressofflineHow can I direct al

    9小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信