How do I change the Account page content?

I want to modify the Account page content to display some of my custom Meta content. How do I go about doing this? Specifically where and what file do I make the changes?

Thanks,

Mike

  • Mike

    Hi Ash,

    Thanks for the information. I am able to comment out the fields that I don't want appearing in my Account page now. Just wondering is there a way to display data from a meta tag in the wp_usermeta table? For instance I have a custom meta_key 'valid_contract'. I would like to display that value in the Account page. I am assuming I just follow the example and insert the tag for the met_key in the code below but that doesn't work:

    public function prepare_fields() {
    		$fields = array(
    			'personal_info' => array(
    				'first_name' => __( 'First name', MS_TEXT_DOMAIN ),
    				'last_name' => __( 'Last name', MS_TEXT_DOMAIN ),
    				'username' => __( 'Username', MS_TEXT_DOMAIN ),
    				'email' => __( 'Email', MS_TEXT_DOMAIN ),
                                    'contract'=>__('valid_contract', MS_TEXT_DOMAIN),
    			)
    		);

    You have any other suggestion?

    Thanks.

  • Ash

    Hello @Mike

    I hope you are well today.

    You need to use get_user_meta function: https://codex.wordpress.org/Function_Reference/get_user_meta

    In the php file, you can use like this:

    echo get_user_meta( get_current_user_id(), 'valid_contract', true );

    The above code will show the valid_contract meta of logged in user's meta value.

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.