Skip to:
Content
Pages
Categories
Search
Top
Bottom

User Profile Url uses the username. Can that be changed?

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

  • J
    Participant

    @paradox_designs

    After 2 months I have resolved this. if anyone else needs help just ask


    dotdatdot
    Participant

    @dotdatdot

    Please do share your solution here as I agree with this being an issue. Thanks in advance!


    J
    Participant

    @paradox_designs

    
    add_action( 'init', 'nicenames_to_display_name' );
    function nicenames_to_display_name() {
        foreach ( get_users() as $user ) {
    		if ( $user->data->user_status == 0 && $user->data->user_nicename != $user->data->display_name ) {
    			$user_ids[] = $user->ID;
    		}
    	}
    	foreach( $user_ids as $uid ) {
    		$info = get_userdata( $uid );
    		$display_name = $info->data->display_name;
    		if ($display_name) {
    			$args = array(
    				'ID'            => $uid,
    				'user_nicename' => strtolower(str_replace(" ", "_", $display_name))
    			);
    			wp_update_user( $args );
    		}
    	}
    }
    

    Jgonl
    Participant

    @jgonl

    Where to put the code?


    Jgonl
    Participant

    @jgonl

    Thanks … ok


    J
    Participant

    @paradox_designs

    Damn, sorry. i hate when others do it and I end up doing it myself…

    This goes in functions.php


    Jgonl
    Participant

    @jgonl

    I figured I should go where the code and may assert.
    Thank you again


    fatsandrew7
    Participant

    @fatsandrew7

    wow! exactly what i was looking for!

    thanks so much!

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
Skip to toolbar