[ad_1]
Maintenance Mode won’t work! My theme is twenty twenty two. I pasted into the functions.php. My site is still visible, but now with this message at the top of the page. Any advice? I thought this would make it so the site won’t be visible at all. Trying to use code not a plug-in.
[ad_2]
Use a maintenance mode plugin instead.
You have not added the code correctly. It’s also not very good code.
Try this. Create a page. Add a ‘back soon’ message (and any other info you want). Check the ID of the page (hover over the ‘edit page’ item and look at the message bottom of screen)
Add this code to your functions.php – change **both** 707 for your actual page ID
`add_action( ‘template_redirect’, function() {`
`if ( is_page( 707 ) ) {`
`return;`
`}`
`if (!current_user_can(‘edit_themes’) || !is_user_logged_in()) {`
`wp_redirect( esc_url_raw( home_url( ‘index.php?page_id=707’ ) ) );`
`exit;`
`}`
`} );`
Firstly it looks like you’ve not added the code properly.
Secondly, you need to check the logged out state to see what the public sees.