plugins - How to call a function from class in wp table list button form

I try to call a function which generates a pdf based on row ID from wp table list So i have:public function column_defau

I try to call a function which generates a pdf based on row ID from wp table list So i have:

   public function column_default($item, $column_name)
        {
            switch ($column_name) {
              case "ID":
                return $item[$column_name]
              case "pdf":
                    return '
                        <form method="post" action="' . esc_attr('admin-post.php'). '">
                        <input type="hidden" name="id" value="pdf_generate"/>
                        <input type="hidden" name="id" value="' . $item['ID'] . '"/>
                        <input type="submit" name="action" value="PDF"/>
                      </form>';
    }

and I'm trying to call a function in another plugin file :

add_action( 'admin_post_pdf_generate', 'pdf_generator' );
 function pdf_generator()
{
  //something mpdf
}

but each time when I click PDF i see blank page and url is example/wp-admin/admin-post.php without any action

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742337897a4425021.html

相关推荐

  • plugins - How to call a function from class in wp table list button form

    I try to call a function which generates a pdf based on row ID from wp table list So i have:public function column_defau

    5小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信