wordpress 文章内容 同步 微博 微信 用什么插件

新手学堂021

wordpress 文章内容 同步 微博 微信 用什么插件,第1张

WordPress

先判断下是否登录,然后获取当前用户对象,然后获取当前用户对象的信息,需要哪些用哪些:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

if(is_user_logged_in()){

$current_user = wp_get_current_user();

/

@example Safe usage: $current_user = wp_get_current_user();

if ( !($current_user instanceof WP_User) )

return;

/

echo 'Username: ' $current_user->user_login '<br />';

echo 'User email: ' $current_user->user_email '<br />';

echo 'User first name: ' $current_user->user_firstname '<br />';

echo 'User last name: ' $current_user->user_lastname '<br />';

echo 'User display name: ' $current_user->display_name '<br />';

echo 'User ID: ' $current_user->ID '<br />';

}

微信小程序和网站信息没有同步。

比如,你用的是 Wordpress 或是其他程序,肯定都有现成的API接口,直接调用这些接口返回数据即可,参考官网文档即可。如果你用的网站程序没有 API,那么就需要自建结构化数据了,这个结构化数据可以手动更新,也可自动更新。例如自己新建 JSON 文件,用wxrequest 请求。

运营LV的管理员可以自行操作信息同步。