【问题标题】:'username_exists' function not working in Wordpress plugin'username_exists' 功能在 Wordpress 插件中不起作用
【发布时间】:2016-08-22 06:20:41
【问题描述】:

我想在我自己的插件中使用“username_exists”,但是当我使用这个函数时,我得到了这个错误:

致命错误:未捕获错误:调用未定义函数 get_user_by() 在 E:\xampp\htdocs\wordpress\wp-includes\user.php:1271 堆栈跟踪:#0 E:\xampp\htdocs\wordpress\wp-content\plugins\register-plus\index.php(86): username_exists('admin') #1 E:\xampp\htdocs\wordpress\wp-settings.php(255): include_once('E:\xampp\htdocs...') #2 E:\xampp\htdocs\wordpress\wp-config.php(89): require_once('E:\xampp\htdocs...') #3 E:\xampp\htdocs\wordpress\wp-load.php(37): require_once('E:\xampp\htdocs...') #4 E:\xampp\htdocs\wordpress\wp-blog-header.php(13): require_once('E:\xampp\htdocs...') #5 E:\xampp\htdocs\wordpress\index.php(17): require('E:\xampp\htdocs...') #6 {main} 抛出 E:\xampp\htdocs\wordpress\wp-includes\user.php 在第 1271 行

我该如何解决?

【问题讨论】:

  • 这个功能是WP还是自定义?
  • 好的。你会打电话给你的插件吗?我认为您的插件不包含该功能
  • 我也觉得。但我不知道我的插件中包含的内容和方式

标签: php wordpress


【解决方案1】:

我在我的插件中包含“pluggable.php”并修复了问题

include_once(ABSPATH . 'wp-includes/pluggable.php');

【讨论】:

    猜你喜欢
    • 2022-12-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-21
    • 1970-01-01
    • 2011-11-08
    • 1970-01-01
    相关资源
    最近更新 更多