Call to undefined function add_options_page()

wordpress

Solution

I had a similar problem, turns out I was running a function too early:

Use `admin_init` hook instead of `init`

Hopefully that helps someone out :D

Problem

I developed the plugin for my wordpress project. I successfully tested it on my local xampp server with 5.3 php. Then I uploaded my project to the web hosting with php 5.2. First trouble which with I faced off was unsupporting anonymous functions in php 5.2. No issue, I redeclared all functions with names. But then I got error Call to undefined function add_options_page(), which I counldn't explain. Plz help me guys with your advices My part of code: ``` function mainPage(){ ///some code } function mainPage2(){ add_options_page('Submissions of MAIN page contact form', 'Submissions of MAIN page contact form', 'manage_options','ea_submissions2', mainPage()); } add_action('admin_menu',mainPage2()); ``` I think something wrong with my funcitons, look through it please. There is no issue with php 5.2 as I thought, this part of code also doesn't work with php 5.3! Something wrong with my code

Original source