Ago 09

Restringir acceso en WordPress

Hay una forma muy simple de proteger el acceso a un blog de wordpress, haciendo requerido el inicio de sesión del usuario.
Este simple plugin hace la tarea:

< ?php /* Plugin Name: Blog Users Only Plugin Plugin URI: http://www.silencesoft.net Description: This plugin allows you to make your WordPress site accessible to logged in and registered users only. Author: Byron Herrera Version: 0.1 Author URI: http://byronh.axul.net/ License: Free. Warranties: None. */ function registered_subscribers_only() { // Checks if a user is logged in, if not redirects them to the login page if (!current_user_can('level_0')) { nocache_headers(); header("HTTP/1.1 302 Moved Temporarily"); header('Location: ' . get_settings('siteurl') . '/wp-login.php?action='); // logout header("Status: 302 Moved Temporarily"); exit(); } } if( $pagenow != 'wp-login.php' && $pagenow != 'wp-register.php' ) add_action('template_redirect', 'registered_subscribers_only'); ?>

Copyright © 2019 Silenceway
Proudly powered by WordPress, Free WordPress Themes

 Subscribe in a reader