<?php
/*
Plugin Name: Héroes y Pasta
*/
include_once(ABSPATH . 'wp-admin/includes/plugin.php');
function iniciatodo() {
if(is_user_logged_in()) {
?>
<p>Hola tio</p>
<?php
} else {
wp_redirect( "http://gexy.es.cx/login/" );
exit();
}
}
add_shortcode("inicia_todo", "iniciatodo");
?>
So I'm making a pluging that has to work different if the user is logged in or not, but when the user is not logged it should redirect to the login page. What is wrong with the code or what does it lacks?
Thank you in advance
wp_loaded
if you are at this page, do the redirection.wp-admin/includes/plugin.php being included
? It should be unnecessary and can cause security issues loading it on the frontend