Title: Redirect to login if not logged in
Author: Daan Kortenbach
Published: <strong>9. Juni 2013</strong>
Last modified: 13. September 2018

---

Plugins suchen

Dieses Plugin wurde **nicht mit den 3 neuesten Hauptversionen von WordPress getestet**.
Es wird möglicherweise nicht mehr gepflegt oder unterstützt und kann bei der Verwendung
mit neueren WordPress-Versionen zu Kompatibilitätsproblemen führen.

![](https://s.w.org/plugins/geopattern-icon/redirect-to-login-if-not-logged-in.svg)

# Redirect to login if not logged in

 Von [Daan Kortenbach](https://profiles.wordpress.org/daankortenbach/)

[Herunterladen](https://downloads.wordpress.org/plugin/redirect-to-login-if-not-logged-in.1.7.0.zip)

 * [Details](https://de.wordpress.org/plugins/redirect-to-login-if-not-logged-in/#description)
 * [Rezensionen](https://de.wordpress.org/plugins/redirect-to-login-if-not-logged-in/#reviews)
 *  [Installation](https://de.wordpress.org/plugins/redirect-to-login-if-not-logged-in/#installation)
 * [Entwicklung](https://de.wordpress.org/plugins/redirect-to-login-if-not-logged-in/#developers)

 [Support](https://wordpress.org/support/plugin/redirect-to-login-if-not-logged-in/)

## Beschreibung

Redirects users to the login page if the user is not logged in. After login the 
user gets redirected to the original entry page. For advanced users a filter is 
provided to override the redirect.

The principle behind this plugin is to redirect all users – from every post, page,
archive, etc. – to the login page (usually wp-login.php). Except for the override
filter it does nothing else.

#### Overriding the redirect

 * **Note:** This plugin may not be for you, a membership plugin might be a better
   fit. Chris Lema writes excellent reviews of +30 membership plugins here: http://
   chrislema.com/category/memberships-plugins/

If you do have a need for this plugin and you want to exclude specific views under
specific conditions, a filter is provided to override the redirect.

To override the redirect the filter must return a boolean value of `true`. WordPress
core provides many conditional tags that either return `true` or `false` or you 
can write your own conditionals.

Take a look at the Conditional Tags page on The WordPress Codex for some inspiration.

https://codex.wordpress.org/Conditional_Tags

**Usage:**
 Copy/paste/edit an example to the functions.php of your theme or create
a new file in wp-content/mu-plugins/ if you do not wish to edit your theme.

_Note: Be carefull not to use multiple filters at the same time as that may cause
unexpected results. Instead use multiple conditions in one filter._

 * Override if the front page is either posts or a page:
 * add_filter( ‚rtl_override_redirect‘, ‚is_front_page‘ );
 * Override if the post is ‚hello-world‘:
 * add_filter( ‚rtl_override_redirect‘, function() {
    return is_single( ‚hello-world‘);});
 * Override if the page is ’sample-page‘:
 * add_filter( ‚rtl_override_redirect‘, function() {
    return is_page( ’sample-page‘);});
 * Override if the page ID is 42, the slug is ’sample-page‘ or the title is ‚About
   Me‘:
 * add_filter( ‚rtl_override_redirect‘, function() {
    return is_page( array( 42,’
   sample-page‘, ‚About Me‘ ) ); });
 * Override if the page ID is 42 or a post is ‚hello-world‘:
 * add_filter( ‚rtl_override_redirect‘, function() {
    if ( is_page( 42 ) || is_single(‚
   hello-world‘ ) ) { return true; } });

## Installation

 1. Upload `redirect-to-login-if-not-logged-in` to the `/wp-content/plugins/` directory
 2. Activate the plugin through the ‚Plugins‘ menu in WordPress

## FAQ

  Installation Instructions

 1. Upload `redirect-to-login-if-not-logged-in` to the `/wp-content/plugins/` directory
 2. Activate the plugin through the ‚Plugins‘ menu in WordPress

## Rezensionen

![](https://secure.gravatar.com/avatar/0f90a478050add8d7fae6ac89c101b63d56a73326528befc136f84ac52f082a5?
s=60&d=retro&r=g)

### 󠀁[plugin causes infinite redirecton loop – not working](https://wordpress.org/support/topic/plugin-causes-infinite-redirecton-loop-not-working/)󠁿

 [maorb](https://profiles.wordpress.org/maorb/) 18. April 2019 3 Antworten

plugin causes infinite redirecton loop – not working

![](https://secure.gravatar.com/avatar/e98b134a808d72224bd3a6d89cce4c99cd884212fd1f11e5dd964fda95ad9703?
s=60&d=retro&r=g)

### 󠀁[How to Allow Some IP?](https://wordpress.org/support/topic/allow-some-ip/)󠁿

 [arthurfrank](https://profiles.wordpress.org/arthurfrank/) 18. Januar 2019

How do we allow access to some IP numbers? This is really important to me. Is it
possible to allow more than 1 IP number?

 [ Alle 11 Rezensionen lesen ](https://wordpress.org/support/plugin/redirect-to-login-if-not-logged-in/reviews/)

## Mitwirkende und Entwickler

„Redirect to login if not logged in“ ist Open-Source-Software. Folgende Menschen
haben an diesem Plugin mitgewirkt:

Mitwirkende

 *   [ Daan Kortenbach ](https://profiles.wordpress.org/daankortenbach/)

[Übersetze „Redirect to login if not logged in“ in deine Sprache.](https://translate.wordpress.org/projects/wp-plugins/redirect-to-login-if-not-logged-in)

### Interessiert an der Entwicklung?

[Durchstöbere den Code](https://plugins.trac.wordpress.org/browser/redirect-to-login-if-not-logged-in/),
sieh dir das [SVN-Repository](https://plugins.svn.wordpress.org/redirect-to-login-if-not-logged-in/)
an oder abonniere das [Entwicklungsprotokoll](https://plugins.trac.wordpress.org/log/redirect-to-login-if-not-logged-in/)
per [RSS](https://plugins.trac.wordpress.org/log/redirect-to-login-if-not-logged-in/?limit=100&mode=stop_on_copy&format=rss).

## Änderungsprotokoll

#### 1.7.0

 * Add redirect override filter.
 * Add filter examples.

#### 1.6.3

 * Fix svn repo.

#### 1.6.2

 * Version file mismatch fix.

#### 1.6.1

 * WordPress 4.2 compatibility update.

#### 1.6

 * WordPress 4.1.1 compatibility update.

#### 1.5

 * Complete rewrite to use the already existing auth_redirect hook.
 * Strips ‚?loggedout=true‘ from redirect url after login.

#### 1.4

 * Moved the conditionals to the init hook due to some edge cases not redirecting.

#### 1.3

 * Plugin naming.

#### 1.2

 * Releasing to the WordPress plugin repo.

#### 1.1

 * Cleanup.
 * Now using wp_login_url() in redirect.

#### 1.0

 * Initial version.

## Meta

 *  Version **1.7.0**
 *  Zuletzt aktualisiert **vor 8 Jahren**
 *  Aktive Installationen **200+**
 *  WordPress-Version ** 3.0.1 oder höher **
 *  Getestet bis **5.0.31**
 *  Sprache
 * [English (US)](https://wordpress.org/plugins/redirect-to-login-if-not-logged-in/)
 * Schlagwörter
 * [login](https://de.wordpress.org/plugins/tags/login/)[redirect](https://de.wordpress.org/plugins/tags/redirect/)
 *  [Erweiterte Ansicht](https://de.wordpress.org/plugins/redirect-to-login-if-not-logged-in/advanced/)

## Bewertungen

 4.8 von 5 Sternen.

 *  [  9 5-Sterne-Rezensionen     ](https://wordpress.org/support/plugin/redirect-to-login-if-not-logged-in/reviews/?filter=5)
 *  [  0 4-Sterne-Rezensionen     ](https://wordpress.org/support/plugin/redirect-to-login-if-not-logged-in/reviews/?filter=4)
 *  [  1 3-Sterne-Rezension     ](https://wordpress.org/support/plugin/redirect-to-login-if-not-logged-in/reviews/?filter=3)
 *  [  0 2-Sterne-Rezensionen     ](https://wordpress.org/support/plugin/redirect-to-login-if-not-logged-in/reviews/?filter=2)
 *  [  0 1-Sterne-Rezensionen     ](https://wordpress.org/support/plugin/redirect-to-login-if-not-logged-in/reviews/?filter=1)

[Deine Rezension](https://wordpress.org/support/plugin/redirect-to-login-if-not-logged-in/reviews/#new-post)

[Alle Rezensionen anzeigen](https://wordpress.org/support/plugin/redirect-to-login-if-not-logged-in/reviews/)

## Mitwirkende

 *   [ Daan Kortenbach ](https://profiles.wordpress.org/daankortenbach/)

## Support

Möchtest du etwas mitteilen? Brauchst du Unterstützung?

 [Support-Forum anzeigen](https://wordpress.org/support/plugin/redirect-to-login-if-not-logged-in/)