Calling WordPress hook from within a class: call to undefined function error
On this line: add_action(‘admin_menu’, array($this, ‘create_menu_item’)); You are correctly passing the create_menu_item method of the current class to callback argument of the add_action() function. You just need to apply the same principle for the callbacks in the add_menu_page() function: add_menu_page( $value->post_title, $value->post_title, ‘manage_options’, $value->post_name.’-admin-page.php’, array( $this, ‘create_admin_page’ ), // <– Here ‘dashicons-location-alt’, 6 ); This … Read more