0

I am creating a plugin which has just one setting which is set with add_option('myinfo') in my main plugin php file. However, I have a second php file which is almost freestanding, except that I want it to get that setting. I tried using get_option('myinfo'), which works in the first file, but in the second file, it gives this error:

Fatal error: Call to undefined function get_option()

Basically, I think that my second php file is totally outside of WordPress. No WordPress specific code works, it just acts like some regular php file. How can I get the php file to have access to the WordPress database?

The file is mostly standalone, all it does is respond to an Ajax request, but I just want it to have this one piece of data from my plugin.

brentonstrine
  • 21,694
  • 25
  • 74
  • 120

1 Answers1

0

I haven't tried it, but this page gives some details of how to include WordPress functions in a standalone page.

This answer covers some of the same ideas.

Community
  • 1
  • 1
Hobo
  • 7,536
  • 5
  • 40
  • 50