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.
如何获取wordpress插件文件中提交的表单数据?
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
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'saction
to point to a plugin file that handles form processing. (I recommend the first option).解决 无用评论 打赏 举报