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 12 Answers
Reset to default 0Check 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
评论列表(0条)