WordPress.org

Galego

  • Temas
  • Plugins
  • Novas
  • Acerca de
  • Padróns
  • Colabora
  • Equipo
  • Meetups
  • Contacto
  • Homenaxes
  • Consigue WordPress
Consigue WordPress
WordPress.org

Plugin Directory

Redirect to login if not logged in

  • Enviar un plugin
  • Os meus favoritos
  • Iniciar sesión
  • Enviar un plugin
  • Os meus favoritos
  • Iniciar sesión

Este plugin non se actualizou en máis de 2 anos. É posible que xa non sexa compatible ou mantido por ninguén, ou podes ter problemas de compatibilidade cando se usa con novas versións de WordPress.

Redirect to login if not logged in

Por Daan Kortenbach
Descargar
  • Detalles
  • Valoracións
  • Instalación
  • Desenvolvemento
Soporte

Descrición

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;
    }
    });

Instalación

  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

Preguntas frecuentes

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

Comentarios

plugin causes infinite redirecton loop – not working

maorb 18 de Abril, 2019 3 respostas
plugin causes infinite redirecton loop – not working

How to Allow Some IP?

arthurfrank 18 de Xaneiro, 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?
Ler todas as 11 opinións

Colaboradores e desenvolvedores

“Redirect to login if not logged in” é un software de código aberto. As seguintes persoas colaboraron con este plugin.

Colaboradores
  • Daan Kortenbach

Traduce “Redirect to login if not logged in” ao teu idioma.

Interesado no desenvolvemento?

Revisa o código, bota unha ollada aorepositorio SVN, ou subscríbete ao log de desenvolvemento por RSS.

Rexistro de cambios

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

  • Versión 1.7.0
  • Última actualización Fai 7 anos
  • Instalacións activas 300+
  • Versión de WordPress 3.0.1 ou superior
  • Probado ata 5.0.22
  • Idioma
    English (US)
  • Etiquetas
    loginredirect
  • Vista avanzada

Valoracións

4.8 de 5 estrelas
  • Valoración de 9 5 estrelas 5 estrelas 9
  • Valoración de 0 4 estrelas 4 estrelas 0
  • Valoración de 1 3 estrela 3 estrelas 1
  • Valoración de 0 2 estrelas 2 estrelas 0
  • Valoración de 0 1 estrelas 1 estrela 0

Engadir a miña recensión

Ver todas as valoracións

Colaboradores

  • Daan Kortenbach

Soporte

Tes algo que dicir? Necesitas axuda?

Ver o foro de soporte

  • Acerca de
  • Novas
  • Aloxamento
  • Privacidade
  • Escaparate
  • Temas
  • Plugins
  • Padróns
  • Aprender
  • Soporte
  • Desenvolvedores
  • WordPress.TV ↗
  • Involúcrate
  • Eventos
  • Doar ↗
  • Five for the Future
  • WordPress.com ↗
  • Matt ↗
  • bbPress ↗
  • BuddyPress ↗
WordPress.org
WordPress.org

Galego

  • Visita la cuenta de X (anteriormente Twitter)
  • Visit our Bluesky account
  • Visita a nosa conta de Mastodon
  • Visit our Threads account
  • Visita a nosa páxina de Facebook
  • Visita a nosa conta de Instagram
  • Visita a nosa conta de LinkedIn
  • Visit our TikTok account
  • Visita a nosa canle de YouTube
  • Visit our Tumblr account
O código é poesía.