我试图让WordPress中当前用户如下面的代码片段当前用户:如何获得
<?php
include('/wp-admin/includes/user.php');
$current_user = wp_get_current_user();
echo 'Username: ' . $current_user->user_login;
?>
,但我得到了以下错误:
Fatal error: Call to undefined function wp_get_current_user() in /membri/mysite/wordpress/getUser.php on line 3
我是什么做错了,我该如何解决?
添加'包括(“/可湿性粉剂管理员/包括/ pluggable.php”) ;'(不要删除用户) –
你的页面位于哪里?实际上,您只需要'wp_get_current_user()'在WordPress中返回当前用户的数组。 – nyedidikeke
我已经解决了函数调用,但现在我已经这个问题:调用未定义功能apply_filters()在/membri/mysite/wordpress/wp-includes/user.php上线2525 – GianLuke94