Removing users from directory but keeping their post info

We have a membership site setup whereby expired users get auto-suspended via an API call. Is there a way for suspended users to not be visible in the user directory?

We don’t want to delete users or anonymize them as this would end up orphaning a lot of posts over time. We’d really like to keep user profile data associated with posts visible so that future users can still see who made a post (rather than just seeing “anon” users).

So is it possible to remove suspended users from the user directory and still keep their user profiles intact when viewed alongside their posts?


Hey @kiefferr

There’s a user setting Hide my public profile and presence features which will remove users from the directory. If you make setting this part of the deactivation process their profile cards will be hidden and they won’t appear in the user directory.


Thanks Steven, maybe we could add a query parameter similar to the logout parameter below that would enable or disable Hide my public profile and presence features when a user gets suspended or unsuspended…

However, I just tried enabling that setting with a test user and the user is still appearing in the user directory…

It would be great if there were simply an option to remove suspended users from the user directory :slight_smile:

I don’t believe suspended users appear in the user directory.

There is a setting that would allow them to be findable in the search (enable listing suspended users on search), but even with that enabled I don’t think they appear in the user directory.

I think they also have their user cards hidden as well if suspended, even without that user preference.

Let me suspend one of my most troublesome test users and check.

Edit: Note for future travellers who land on this by search - I actually got this muddled with ‘deactivating’ them as well so read further down. :arrow_double_down: :slight_smile:

1 Like

Thanks Jammy. I just checked again to confirm I saw the suspended user in the user directory. You are right that suspended users don’t display. BUT…

Strangely, I can see suspended users in the user directory from one of my test accounts…

When I search for him in the user directory with other accounts, including my admin acct, he is not visible.

1 Like

Yes, I’m actually seeing the same thing. :thinking:

But I think a key part of the puzzle I was missing versus what I was expecting was to also mark their account as ‘inactive’:

This would then remove them from the user directory, even without searching (as soon as the background job runs. Every hour for the daily view, once a day for the other older ones)

And this is also what gives the simplified user card I was thinking of:

And because they’re also suspended they can’t log in to reactivate their account.

Would this work for you?

1 Like

Thanks Jammy! Correct me if I’m wrong but you’re saying that accounts that are suspended will not show when searched for in the user directory, but they must also be deactivated to never display at all?

The jives with what I’m seeing… I can’t find suspended users when I search for them, but they will still display from within the main user directory page.

We used the API protocol to suspend users that expire as members within our WP instance, and it looks like we could add a function to “deactivate” and “activate” in much the same way as we did to “suspend” and “unsuspend.”

If all that is correct, then I think this would work for us.


1 Like

That’s currently how it’s set up. :+1: I think it is a little unusual that they appear in the big list even though they can’t be searched for, so it may be worth a ux topic to see if that can be tweaked if you did want to go that route.

I think this is how a few sites handle off-boarding paid members (and/or employees), so I think it’s worth a test run to see how you like it. :+1: