我正在自定义WP管理区域,并希望我使用的功能只影响特定用户。关于如何写这个有什么想法吗?
如何创建仅影响特定用户的功能
2 个回复
SO网友:s_ha_dum
get_currentuserinfo();
if ( $current_user->ID === <ID of user to isolate>) {
// user specific code
}
http://codex.wordpress.org/Function_Reference/get_currentuserinfo
这是一个非常普遍的解决办法。可能还有其他/更好的解决方案,但您没有提供有关您试图实现的目标的更多信息。SO网友:Ken
<?php get_currentuserinfo(); ?>
然后检查$current\\u user->ID的返回值是否为所需用户的ID,然后仅显示该用户的内容?结束