Puddinq.com sharing knowledge

Hide userprofile fields like facebook url – in edit profile

Hide userprofile fields like facebook url - in edit profile

When you give access to the backend for minimal users, you will want te reduce the available options to make it more easy. One thing is the edit user profile where there are a lot of unused options. By adding (or removing) classes in the list you can hide the fields. Find the class associated with the table row and add ( or remove ) them from the list in the script.

// hide Profile fields
add_action( 'admin_footer-user-edit.php', 'remove_user_fields' );
add_action( 'admin_head-profile.php', 'remove_user_fields' );
function remove_user_fields(){

            ?>
            <script type="text/javascript">
                jQuery(document).ready( function($) {
                    // the following IDs are the input elements of the unneeded fields
                    var ids = ['.user-admin-color-wrap', //
                        '.user-admin-bar-front-wrap', //
                        '.user-language-wrap', //
                        '.user-display-name-wrap', //
                        '.user-url-wrap', //
                        '.user-facebook-wrap', //
                        '.user-instagram-wrap', //
                        '.user-linkedin-wrap', //
                        '.user-myspace-wrap', //
                        '.user-pinterest-wrap', //
                        '.user-soundcloud-wrap', //
                        '.user-tumblr-wrap', //
                        '.user-twitter-wrap', //
                        '.user-youtube-wrap', //
                        '.user-wikipedia-wrap', //
                        '.user-profile-picture'
                        ]
                    for (var i = 0; i < ids.length; i++) {
                        $(ids[i]).closest('tr').remove();
                    }
                });
            </script>
<?php
}