Call current_user_can after init()

This error appears on wordpress when I activate debug mode, and using bbpress and buddypress, the error was a requiremnt on using the init function before use a restriction related with the function current_user_can

After having this using on a theme development, I have check some pages like

Finally my solution was create a function as says and warning disappear

function restrict_admin(){
//if not administrator, kill WordPress execution and provide a message
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( __('You are not allowed to access this part of the site') );
add_action( 'admin_init', 'restrict_admin', 1 );


Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de

Estás comentando usando tu cuenta de Cerrar sesión /  Cambiar )

Google photo

Estás comentando usando tu cuenta de Google. Cerrar sesión /  Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión /  Cambiar )

Conectando a %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.