I have to perform this action:
add_action('admin_menu', function(){
add_options_page(
'Submissions of MAIN page contact form',
'Submissions of MAIN page contact form',
'manage_options',
'ea_submissions2',
news()
);
});
In PHP 5.2 anonymous functions are not supported, so I made the following:
function news_opt(){
add_options_page(
'Submissions of MAIN page contact form',
'Submissions of MAIN page contact form',
'manage_options',
'ea_submissions2',
news()
);
}
add_action('admin_menu', news_opt());
And after that I got Fatal error: Call to undefined function add_options_page() error. What is the issue?
If you append
()
, you’re calling the execution of a function. And it has to be passed as a string:And
The documentation for
add_options_page
andadmin_menu
would have shown that. When some WordPress function or hook doesn’t work, always check if the Codex has useful information.