I have a wordpress function in functions.php which gets parameters from a form I made and gets parameters like IP addresses and UTM tags (from the URL) and sends them to me by email.

I want to get all these parameters I send and store them in a new table on my WP database.

How can I do such thing?

I researched it and found a lot of plugins that can do that for me (Which I really don't want to use external plugins). and I still want to keep wordpress security and not use a "flat" code of my own.

How do I plan this? Is this even possible?

  • As your question is, it is so board that it can not be answered here easily. That being said, using plugins is a very good option if the plugin is well coded and does exactly what you want, specially if you don't know how to do it at your own. – cybmeta Aug 2 '15 at 14:32
  • I want to learn doing this by myself.. what should I start researching more specifically ? – Kar19 Aug 2 '15 at 14:34
  • You could start reading these entries in Wordpress documentation: Creating Tables with Plugins and wpdb class. You could also be interested in more general readings about database field types to correctly define and optimize your database table, but I can not find a good but basic tutorial and I'm not a database expert, sorry. – cybmeta Aug 2 '15 at 14:41
  • for the idea to create a new table, I advice you to avoid this and to use a custom post type for storing data : codex.wordpress.org/Function_Reference/register_post_type – mmm Aug 2 '15 at 14:51
  • @mmm I'm not sure what that even mean, but I'll right it down as a note. – Kar19 Aug 2 '15 at 15:00

I suggest for you some ideas :

  1. Before run functions from you make, you register table database store ( Example WP_IP and WP_UTM )
  2. After create 2 table that, you run function of you
  3. You need read on Codex some resource on WP working with parameters :

https://codex.wordpress.org/Class_Reference/wpdb https://codex.wordpress.org/Creating_Tables_with_Plugins

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.