• Resolved simo_diap

    (@simo_diap)


    Hello to everyone,

    i’m tring to hide some fields from the page profile.php to avoid the users can edit passwords, mail and others custom field but i couldn’t find a properly way to do that.

    i tried this lines but they didn’t hide the label password and the input related to password fields

    add_action( ‘init’, ‘disable_password_fields’, 10 );

    function disable_password_fields() {
    if ( !current_user_can( ‘administrator’ ) )
    $show_password_fields = add_filter( ‘show_password_fields’, ‘__return_false’ );
    }

    Is there a way to list fields and custom fields to hide in profile.php?
    Thanks in advance,
    Simone

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello Simone,

    I have done this tactic using jQuery in my one of the project.

    <?php
    add_action('admin_head','hide_personal_options');
    function hide_personal_options() { ?>
        <script type="text/javascript">
        jQuery(document).ready(function($) {
        	$("#email").parent().parent().remove();  // Add id of email or whatever you want to hide
        });
        </script>
    <?php }

    Let me know if this helps you.

    Thread Starter simo_diap

    (@simo_diap)

    Thank you Bhavesh Patel,

    It works great!

    Simone

    Please mark it resolved.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hide some fields from profile.php’ is closed to new replies.