Object Oriented Plugin Posting/Linking to a class.
-
If I want to post to one of my classes or link to it, I am currently using the following logic. Is there a better way to do this? Thanks in advance.
//instantiate the object $path1 = ABS_CONTROLS_PATH . 'class.admin.myclass.inc'; require_once $path1; $myclassObj = new myclass(); //Create a hidden page, //that basically just points to the function and class. add_submenu_page( "", "Do Something", "", "manage_options", 'admin-myclass-dosomething', array($myclassObj, 'dosomething') ); //Then create a constant for the link define("CATEGORY_ACTION_DISPLAY", '?page=admin-myclass-dosomething', true); //Then the link looks like this https://wp1.localhost/wp-admin/admin.php?page=admin-myclass-dosomething&id=BDBED1D3-2D41-11E3-8485-79F665153CEA
- The topic ‘Object Oriented Plugin Posting/Linking to a class.’ is closed to new replies.