douji2520 2015-06-26 10:15
浏览 464

如何获取wordpress插件文件中提交的表单数据?

I want to submit a form which contains a textarea to my Wordpress plugin. But I don't know exactly HOW. I want my plugin to fetch the $_POST variable after the submission of the form that I create for it. The other idea would an setting fields. Having setting fields to save some data in it then accessing them via plugin. All in all, I want to be able to access the setting form, input, textarea and other form elements values through my Wordpress plugin. I know the question sounds novice, I couldn't find any search result regarding my question.

  • 写回答

1条回答 默认 最新

  • duanan1946 2015-06-26 10:40
    关注

    I would create a function in your plugin and add it into the init action hook. This is a great time to intercept $_POST data and do with it what you wish.

    function intercept_post_data() {
        // do things with the $_POST array
    }
    add_action( 'init', 'intercept_post_data' );
    

    However, you also have the option to POST directly to your plugin by changing the form's action to point to a plugin file that handles form processing. (I recommend the first option).

    评论

报告相同问题?

悬赏问题

  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题