Restrict Access to site

Is there a way to restrict access to site via code or plugin to only logged in users with Auth0?

Hello @anhtuandinh,

Welcome to the Community!

You can allow / deny access using a Rule. For example:

function (user, context, callback) {
  var groupAllowed = 'group1';
  if (user.groups) {
    var userHasAccess = user.groups.some(
      function (group) {
        return groupAllowed === group;

    if (!userHasAccess) {
      return callback(new UnauthorizedError('Access denied.'));

  callback(null, user, context);
1 Like

I figured it out with use of Force Login wordpress plugin

1 Like

Glad you have it working and thanks for sharing the solution with the rest of community!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.