Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class my_class {
- public $output
- public function __construct() {
- $this->output .= '<form method="post" action="' . admin_url('admin-post.php') . '">;
- $this->output .= '<input type="hidden" name="action" value="do_something"/>';
- $this->output .= '<input type="submit" value="click here"/>';
- $this->output .= '</form>';
- add_action('admin_post_do_something', array(&$this, 'do_something'));
- add_action('admin_post_nopriv_do_something', array(&$this, 'do_something'));
- add_action('admin_post_nopriv_register_do_something', array(&$this, 'do_something'));
- }
- public function do_something() {
- //This doesn't get called, whenever I click the button which is displayed through display_form() from another class which is registered as a shortcode (which works), then admin-post.php in wp-admin/admin-post.php returns a blank screen.
- status_header(200);
- die('success');
- }
- public function display_form() {
- return $this->output;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement