admin管理员组文章数量:1026989
So I'm learning modern WordPress Development and I'm using classes to organise code etc. I'm having a problem where I'm getting the message: Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'show_message_page' not found or invalid function - Why am I getting this warning when the "Hello" inside the function is working and I can see it on the screen?
I've tried different actions parameters including init.
Here's my code
public function __construct( $plugin ) {
$this->plugin = $plugin;
$this->auth_redirect_uri = get_admin_url( null, 'admin.php?page=clients' );
}
public function init() {
add_action( 'admin_menu', [ $this, 'add_to_admin_menu' ] );
}
public function add_to_admin_menu() {
add_submenu_page(
'clients',
__( 'Messages', 'clientmessage' ),
__( 'Messages', 'clientmessage' ),
'manage_options',
'client_message',
[ $this, 'show_message_page' ]
);
}
public function show_message_page() {
echo "Hello";
}
So I'm learning modern WordPress Development and I'm using classes to organise code etc. I'm having a problem where I'm getting the message: Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'show_message_page' not found or invalid function - Why am I getting this warning when the "Hello" inside the function is working and I can see it on the screen?
I've tried different actions parameters including init.
Here's my code
public function __construct( $plugin ) {
$this->plugin = $plugin;
$this->auth_redirect_uri = get_admin_url( null, 'admin.php?page=clients' );
}
public function init() {
add_action( 'admin_menu', [ $this, 'add_to_admin_menu' ] );
}
public function add_to_admin_menu() {
add_submenu_page(
'clients',
__( 'Messages', 'clientmessage' ),
__( 'Messages', 'clientmessage' ),
'manage_options',
'client_message',
[ $this, 'show_message_page' ]
);
}
public function show_message_page() {
echo "Hello";
}
本文标签: pluginsWarning calluserfuncarray() expects parameter 1 to be a valid callbackfunction
版权声明:本文标题:plugins - Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1741621167a1878949.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论