开发者

How do I insert to database on submit from theme options page for wordpress?

I'm looking for a way on how to insert the data that is entered in my theme options page that I created. I found different tutorials on how to create the theme options page, but how do you save the info to mysql once updated?

开发者_如何学编程

An example or code snippet would be greatly appreciated, Thanks!


If you're using the WordPress options database to store your information (which it should), then the Codex has all the answers you're looking for. Using the correct API will automatically save & retrieve options for you.

http://codex.wordpress.org/Creating_Options_Pages

http://codex.wordpress.org/Options_API


I have been searching this answer as well. As it seems, WordPress options form posts to "options.php" and I haven't found a hook to capture form's submit to add custom actions to form's submit.

So my solution is to add a second form in the same page, which will post to my page, so as to have the $_POST values available and perform any actions I want. Be sure the second form to be below and not inside the first one.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜