Skip to content

Commit

Permalink
Add forced login to devberry
Browse files Browse the repository at this point in the history
  • Loading branch information
szepeviktor committed Nov 4, 2023
1 parent fd598d3 commit 12af1cf
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions mu-plugins/devberry.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
* Plugin URI: https://github.com/szepeviktor/wordpress-website-lifecycle
*/

// Discourage Search Engines.
add_filter(
'option_blog_public',
'__return_zero',
PHP_INT_MAX,
0
);

// Discourage Search Engines in HTTP headers.
add_action(
'send_headers',
static function () {
Expand All @@ -22,6 +24,7 @@ static function () {
0
);

// Display Devberry.
add_action(
'wp_footer',
static function () {
Expand Down Expand Up @@ -84,3 +87,16 @@ static function () {
10,
0
);

// Force visitors to log in.
add_action(
'template_redirect',
static function () {
if (!is_user_logged_in()) {
wp_redirect(wp_login_url($_SERVER['REQUEST_URI']));
exit;
}
},
0,
0
);

0 comments on commit 12af1cf

Please sign in to comment.