admin管理员组文章数量:1122832
I am having hard time for importing to user-meta and post-meta from my non-wp-tables. I am trying to do db migration from user table and post table to WordPress tables.
So it might be
- user table to wp-users and wp-usermeta
- post table to wp-posts and wp-postmeta
I have been trying to find good plugins but it's all limited. (only basic information)
My old user table has all of users information on only 1 row (1 line) such as phone number, mobile, DOB..
etc. These have to be on user-meta table.
Old user tables and wp-users are on same database now.
How can I insert user information from old user table to wp-user(for basic information) and wp-usermeta (for extra information)?
Is it possible to make it with PHP coding? (because it's on same database) I am trying to figure it out how to do with php coding or something else.
If anyone knows can you advise me a sample coding? or anybody knows any good plugins? all of them I found are not enough to put all of user information.
I am having hard time for importing to user-meta and post-meta from my non-wp-tables. I am trying to do db migration from user table and post table to WordPress tables.
So it might be
- user table to wp-users and wp-usermeta
- post table to wp-posts and wp-postmeta
I have been trying to find good plugins but it's all limited. (only basic information)
My old user table has all of users information on only 1 row (1 line) such as phone number, mobile, DOB..
etc. These have to be on user-meta table.
Old user tables and wp-users are on same database now.
How can I insert user information from old user table to wp-user(for basic information) and wp-usermeta (for extra information)?
Is it possible to make it with PHP coding? (because it's on same database) I am trying to figure it out how to do with php coding or something else.
If anyone knows can you advise me a sample coding? or anybody knows any good plugins? all of them I found are not enough to put all of user information.
Share Improve this question edited Oct 15, 2013 at 8:46 Eugene Manuilov 11.4k4 gold badges44 silver badges50 bronze badges asked Oct 15, 2013 at 8:30 pullapulla 7234 gold badges17 silver badges34 bronze badges1 Answer
Reset to default 0- get all data from DB1( non-wp-database ) and save to an $array.
- Use this wordpress code inside your functions.php for insert users into DB2 ( wordpress database).
function cxg_wp_insert_user() { foreach ( $array as $arr ) { $user_data = array( 'ID' => '', 'user_pass' => wp_generate_password(), 'user_login' => $loginName, 'user_nicename' => $nicename, 'user_url' => '', 'user_email' => $eMail, 'display_name' => $displayName, 'nickname' => '$nickname, 'first_name' => $firstName, 'role' => get_option('default_role') } ); $user_id = wp_insert_user( $user_data ); } add_action( 'admin_init', 'cxg_wp_insert_user' ); 3. After updating disable this function
NOTE : For more details about insert user goto wordpress insert user codex
本文标签: import (migration) user database to wpusers
版权声明:本文标题:import (migration) user database to wp-users 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736286983a1927784.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论