Ecommerce Shopify WordPress Discussion

Cannot connect to a function within an add_submenu_page() using OOP

This is my first transition to OOP in a WordPress plugin. I am trying to create a submenu in Settings and the associated function to drive an admin screen. The code below creates the menu item successfully but when I select the menu item, I receive the following error: call_user_func_array(): Argument #1 ($callback) must be a valid callback, function "aa_admin_nsp_signoff_nav" not found or invalid function name. Any insight to what I'm doing wrong is greatly appreciated! class AaSignTheForm { public function __construct() { add_action( 'admin_menu', array( $this, 'aa_nsp_signoff_submenu' ) ); } public function aa_nsp_signoff_submenu() { add_submenu_page( 'options-general.php', 'Nominal Sale Price Signoff', 'NSP Signoff', 'administrator', 'aa-signoff', 'aa_admin_nsp_signoff_nav' ); } } new AaSignTheForm();
I just added $this in an array for the callable function: add_submenu_page( 'options-general.php', 'Nominal Sale Price Plugin Signoff', 'NSP Signoff', 'administrator', 'aa-signoff', array( $this, 'aa_admin_nsp_signoff_nav' )); }

February 4, 2024

TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.