Why not connect PHP file in the Admin panel?

Hello!

Connect the file to function.php:

require_once get_stylesheet_directory() . '/assets/folder/file.php';


Then in the Admin, when you call the function from that file, get the error message:

Fatal error: Uncaught Error: Call to a member function my_function() on null...

I mean, he doesn't see the functions from that file. Why?

Thank you!
March 23rd 20 at 18:59
1 answer
March 23rd 20 at 19:01
It is possible to call my_function() happens BEFORE the file is mounted.

Find more questions by tags WordPress