Soliloquy Documentation

Documentation, Reference Materials, and Tutorials for Soliloquy

Limit Soliloquy to Admin Users Only

Sometimes you need to limit access to Soliloquy to certain user groups.

You can use the code below in your projects to limit access to Soliloquy to admin users only. Just place this bit of code into your¬†active theme’s functions.php¬†file:

add_action( 'init', 'tgm_soliloquy_restrict_admin_access', -1 );
function tgm_soliloquy_restrict_admin_access() {

    if ( ! is_admin() ) {
        return;
    }

    if ( class_exists( 'Soliloquy' ) ) {
        if ( ! current_user_can( 'update_core' ) ) {
            remove_action( 'init', array( Soliloquy::get_instance(), 'init' ), 0 );
            remove_action( 'widgets_init', array( Soliloquy::get_instance(), 'widget' ) );
        }
    }

}
[i]
[i]