WordPress Plugin Error Call to undefined function wp_get_current_user
X

Congrats, You are Subscribed to Receive Updates.

WordPress Plugin Error Call to undefined function wp_get_current_user


WordPress Plugin Error Call to undefined function wp_get_current_user. If you have the problem of using the User functions like the get_current_user and get_user_by_id and get_current_userinfo. You need to understand that there are two reasons for the issue.

The very first one is file doesnot included properly, either the function doesnot comes under the WordPress hooks. Else you may included the file double times.

wp_kv_functions

The second reason is, the pluggable class. I mean, there is a class which supports you to perform the Core functions on the plugin. Just include the following code to get activate these functions.

<?php
if(!function_exists('wp_get_current_user')) {
    include(ABSPATH . "wp-includes/pluggable.php"); 
}
?>

The above code may help you, If it doesnot help you to get working on the custom functions. Try one more trick, it may help you to solve your issues.

<?php 

include(ABSPATH.'wp-blog-header.php');
?>

This will be an alternative way to connect all wordpress core functions again with you custom plugin.

commenter

About Varadharaj V

The founder of Kvcodes, Varadharaj V is an ERP Analyst and a Web developer specializing in WordPress(WP), WP Theme development, WP Plugin development, Frontaccounting(FA), Sales, Purchases, Inventory, Ledgers, Payroll & HRM, CRM, FA Core Customization, OpenCart Theme Development, PHP, HTML, CSS, jQuery, Bootstrap development and content SEO.

Comment Below

Your email address will not be published. Required fields are marked *

*

Current ye@r *

Menu

Sidebar

Subscribe E-mail Updates

Congrats, You are Subscribed to Receive Updates.

Advertisement

Category Posts