Products
GG网络技术分享 2025-03-18 16:12 3
I am trying to use my current sessions inside WordPress. I have an existing website built using PHP that is a non-WordPress site, and now I want to add a blog feature on my website, and I think WordPress is the best platform for the job.
My problem is that I have existing users that are non-WordPress, and I don\'t want to register my existing users one by one into WordPress. I don\'t want to import my existing users table into WordPress if a new member is added.
Is there any way to use my current user session inside WordPress?
图片转代码服务由CSDN问答提供
感谢您的意见,我们尽快改进~
功能建议我正在尝试在WordPress中使用我当前的会话。 我有一个使用PHP构建的现有网站,这是一个非WordPress网站,现在我想在我的网站上添加一个博客功能,我认为WordPress是这个工作的最佳平台。</ p>
< 我的问题是我有非WordPress的现有用户,我不想将我现有的用户逐个注册到WordPress中。 如果添加了新成员,我不想将现有用户表导入WordPress。</ p>
有没有办法在WordPress中使用我当前的用户会话? </ p>
</ div>
I am able to make this possible by creating two plugins in wordpress the first one is referencing a existing plugin ext_db_auth and the other one is using below code referencing here.
Hope this will be useful for those who are seeking for the same functionality.
add_action(\'init\', \'myStartSession\', 1);add_action(\'wp_logout\', \'myEndSession\');
add_action(\'wp_login\', \'myEndSession\');
function myStartSession() {
if(!session_id()) {
session_start();
}
}
function myEndSession() {
session_destroy ();
}
###
You must import your user\'s table to WordPress users.
The best practice its to convert your site to WordPress theme.
But if it\'s heavy for you, you have more option as follow, In order of priorities in descending order:
Demand feedback