[wp-hackers] 2.8, add_submenu_page and class functions

Dan Cameron dan at sproutventure.com
Thu Jun 11 18:17:23 GMT 2009


Hey guys, it's been too long :)

I'm running into some issues when I want to use add_submenu_page with  
something like:
	array( $this, 'displayThisPage' ) )
for the function.

Strangely, the top menu works fine (since it's shared) but any  
subsequent sub_pages get an error[1].

For example,

add_menu_page( __( 'Options' ), __( 'Options' ), 'read', 'test',  
array( $this, 'displayBasePage' ) );
add_submenu_page( 'test', __( 'Test Description' ), __( 'Test  
Description' ), 'read', 'test', array( $this, 'displayBasePage' ) );
add_submenu_page( 'test', __( 'Sub Description' ), __( 'Sub  
Description' ), 'read', 'sub', array( $this, 'displaySubPage' ) );

If I wrap what's above inside an action of:



Cheers.



[1]
Warning: call_user_func_array() [function.call-user-func-array]: First  
argument is expected to be a valid callback, 'Array' was given in / 
FULL/PATH/wp-includes/plugin.php on line 339




-- 


// Dan Cameron
SproutVenture // grow your business


More information about the wp-hackers mailing list