Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No access to wordpress functions from plugin files

Tags:

wordpress

I came across this problem when I was creating a plugin. I cannot call(access ) wordpress default functions like wp_get_current_user(), $wpdb->get_results(), admin_url() etc. from my plugin files. I can access them from my main file of that plugin in which plugin description is given. But I cannot access them from other plugin files. At that time I heard that if we create a new file functions.php and put these code in that file inside a function I can access all wordpress functions. I did so. But now I cannot access that new function. How can I solve this problem? I think you guys understood what I said. Please help me.

like image 216
Prashanth Shyamprasad Avatar asked Feb 25 '23 01:02

Prashanth Shyamprasad


1 Answers

@Jan : I got the required thing. I just put require_once('../../../wp-load.php'); in my plugin files and now can access all wp functions from there. Any ways thanks for your reply.

like image 66
Prashanth Shyamprasad Avatar answered Mar 05 '23 03:03

Prashanth Shyamprasad