Hi,
I started developing a plugin from scratch and I have a small problem with my setup.
Firstly, here is the error I am getting:
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'my_function' not found or invalid function name in C:\...\wp-includes\plugin.php on line 405
And here is my code:
add_action( 'admin_menu', array( 'my_plugin', 'menu' ) );
class my_plugin {
function menu() {
if ( current_user_can( 'manage_options' ) ) {
add_menu_page( 'Settings', 'Settings', 'manage_options', 'my-plugin', 'my_function' );
}
}
function my_function() {
include 'inc/settings.php';
}
}
$my_plugin = new my_plugin;
I am new to PHP classes and I can't see what is wrong.
Thanks for any ideas.