Blog

2017.11.09

How to remove WordPress admin Profile page fields (Including Personal Options, Biographical Info, Website etc.) and titles without JS

In categories: Tutorials, Website development, Wordpress

Recently had been working on this project of mine where I came upon a problem – how to remove WordPress admin Profile page fields and titles that will not be needed for users who will be using the new system.

You do not want your users to be confused with information that they don’t have to input therefore it might be a good idea to remove them. And I mean removing them since hiding is not an option and it involves CSS or JS solution that makes those fields and titles disappear after the page has loaded and it means that the user gets to see some flickering in the fields.

Here is the final result of my Profile page:

In my case I needed the following fields and titles to be removed from the WordPress admin Profile page:

  • “Personal Options” title
  • “Visual Editor” checkbox (Disable the visual editor when writing)
  • “Keyboard Shortcuts” checkbox (Enable keyboard shortcuts for comment moderation)
  • “Name” title
  • “Toolbar” checkbox (Show Toolbar when viewing site)
  • “Nickname” field (which is required therefore it still has to be hidden not removed)
  • “Display name publicly as” dropdown
  • “Contact Info” title
  • “Website” field
  • “About Yourself” title
  • “Biographical Info” textarea field
  • “Profile Picture” image

I searched the internet all over and wanted to find a solution that would be based on WordPress hooks and wold allow me to unset or alter the output of the Profile page but with no luck. In the end I came across a solution that hooks into the output of the admin Profile page and allows you to use preg_replace function in order to cut out information that is not needed.

Since the structure of the page is laid out in tables and rows, I had to base the preg_replace function on table row classes and heading content had to be used in order to find them and replace them with nothing. Yes, this is not a beautiful solution and it will work until WordPress doesn’t change the classes or structure of the Profile page but that usually doesn’t happen so often.

So here is the solution How to remove WordPress admin Profile page fields (Including Personal Options, Biographical Info, Website etc.) and titles without JS. Simply copy and paste it in your functions.php file:

So this does the trick and removes fields from admin Profile page but we are not able to remove the nickname field like this since it is mandatory. So for this I am still using the solution with JS like so:

And the only thing that could be removed via hook was Admin color scheme and it is done like so:

Let’s hope that WordPress team will soon create hooks that will easily allow us to change the admin Profile page but for now this is what worked for me beautifully. No need to hide the fields using Javascript, just use the above code and throw out the lines you do not wan’t to be removed.

Nauris Kolāts

Nauris is a freelance designer / developer who loves to dig into the UX as much as in the ground for fishing worms. And fishing is just one amongst the long list of his active lifestyle hobbies.

Other posts

Your thoughts

Thoughts

  1. erick

    I tried your code, but proof reading, english options, language, ignored phrases are still there. I want to hide them also, please help.

    Screenshot is here – https://imgur.com/QzSceaa

    • Nauris Kolāts

      Hi Eric,

      It looks like you are using some sort of custom plugins or themes, is that right?
      This tutorial only covers default WordPress Profile panel and does not far beyond that. In order to remove plugin specific fields from admin profile page you will have to dig into the code of the plugin that is creating these additional fields.

  2. erick

    Thanks for your reply and suggestion, after an hour of working it out. I found out that my jetpack plugin’s proofreading feature is the problem.

  3. Torben Wiesbach

    I tried your snippets, but the only part that worked is “Removes ability to change Theme color for the users”. The other additional code doesn’t affect my profile page in any way. Have you got any idea why?

    • Nauris Kolāts

      Hey Torben,

      Hmm, it is quite hard to tell what could be the issue there, but it should be related to functions.php file.
      I just checked the code and tested it on the latest WP version and it still works as it should.

      I would suggest you to also take a look at other plugins you have setup and try to disable them and test again. Or even download a blank theme and test it there.

      Best

  4. Lalit

    Nauris, you are a genius. I was looking for this solution and I found it on your site. Thanks

  5. Colleen

    Thank you so much for this helpful post!
    @Torben Wiesbach, I know I’m late to reply, but I realized that I could still see everything because I was logged in as an admin. When I logged in as a lower permission user, it was all removed. Hope that helps you!

  6. nadja petrov

    Hello, thanks for this post, is excelent! now on the profile page, users can swap from any roles, it is posible to remove the USER ROLE too on users profile page? thanks…

    • Nauris Kolāts

      Hi Nadja,

      Thanks for your comment.
      I just did a couple of tests and wasn’t really able to reconstruct your scenario.
      The only time I’m able to change a role for the user is when I’m trying to create a new user and there I’m able to select which role should he be assigned to.
      If your users really can switch between different roles then it sounds more like some sort of a plugin that you have setup there. Try disabling your plugins to find out which one adds this functionality and then work your way up to solve this issue.
      By default WordPRess doesn’t allow your registered users to change their role from e.g. “Customer” to “Administrator” since that would be a major security concern.

      Best wishes

 

Latest work