How to remove Facebook and Twitter URL from profile page

#144198
  • Resolved Sandro
    Rank Math free

    How can I remove Facebook and Twitter URL fields from profile page?
    I have a website where users can edit their profile page with basic info, but I don’t like to have this two fields in the profile page for each user.

    Twitter username (without @)
    Facebook profile URL

    How can I remove it?

    Screenshot

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

    Thank you for contacting Rank Math and bringing your concern to our attention.

    You can use this filter to disable the Facebook and Twitter URL on the user profile page

    function filter_user_contact_methods( $methods ) {
        // To remove a method
        unset( $methods['Twitter'] );
        unset( $methods['Facebook'] );
        }
    add_filter( 'user_contactmethods', 'filter_user_contact_methods' );

    Please paste this code to the very bottom part of your theme’s functions.php file.

    I hope that helps. Thank you, and looking forward to your update.

    Sandro
    Rank Math free

    Thank you but the code is not working.
    I just fixed some line (this is working).

    
    function filter_user_contact_methods($methods) {
        // To remove a method
        unset($methods['twitter']);
        unset($methods['facebook']);
        return $methods;
    }
    add_filter( 'user_contactmethods', 'filter_user_contact_methods', 99);
    
    Febby
    Rank Math free

    Hello,

    Thank you for letting us know and We are super happy that this resolved your issue.

    If you have any other questions in the future, know that we are here to help you.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘How to remove Facebook and Twitter URL from profile page’ is closed to new replies.