Title: creating table on plugin activation
Last modified: August 30, 2016

---

# creating table on plugin activation

 *  Resolved [ajayphp](https://wordpress.org/support/users/ajayphp/)
 * (@ajayphp)
 * [11 years ago](https://wordpress.org/support/topic/creating-table-on-plugin-activation/)
 * Hi,
 * First congrats for creating such beautiful framework,
 * I was exploring this framework, and mostly all have ,
    to activate and deactivate
   plugin settings.
 * what method or what place is better for creating custom plugin table
    to store
   data.
 * does your setUp() mehod is fine or some where else for better
    speed creating
   table on activation and remove on deactivate plugin etc.
 * – i want to store all items in my custom table and do not want to
    save options
   in WP default as your framework, how to not save options .
 * or how to some times save few option s and few data in custom table.
 * or how to save data to wp default tables.
 * Regards,
 * [https://wordpress.org/plugins/admin-page-framework/](https://wordpress.org/plugins/admin-page-framework/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [miunosoft](https://wordpress.org/support/users/miunosoft/)
 * (@miunosoft)
 * [11 years ago](https://wordpress.org/support/topic/creating-table-on-plugin-activation/#post-6239746)
 * Hi,
 * > what method or what place is better for creating custom plugin table
   >  to store
   > data.
   > does your setUp() mehod is fine or some where else for better
   >  speed creating
   > table on activation and remove on deactivate plugin etc.
 * Sounds like you want to use the plugin activation hook ([https://codex.wordpress.org/Function_Reference/register_activation_hook](https://codex.wordpress.org/Function_Reference/register_activation_hook))
   and uninstall.php ([https://developer.wordpress.org/plugins/the-basics/uninstall-methods/#uninstall-php](https://developer.wordpress.org/plugins/the-basics/uninstall-methods/#uninstall-php))
   to create and delete custom database tables.
 * To insert data of a custom database table to the framework option array, use 
   the `options_{instantiated class name}` filter hook. If you define a callback
   method in the class, just define a method with that name. And return a customized
   array from that method. The form will use it and the values of the array should
   be reflected in the form.
 * To save the submitted form data to a custom database table, use the `validation_{
   instantiated class name}` filter hook. The first parameter will receive an array
   holding the user inputs of the form. Parse it and save the data in your custom
   table.
 * And to disable the default behavior of saving form data in the options table,
   pass an empty string to the first parameter of the class constructor.
 * Hope it helps!
 *  Thread Starter [ajayphp](https://wordpress.org/support/users/ajayphp/)
 * (@ajayphp)
 * [11 years ago](https://wordpress.org/support/topic/creating-table-on-plugin-activation/#post-6239767)
 * Hi,
    Thx. for reply. But you did not answer my first query,
 * i know about register_activation_hool and uninstall
 * i would like to know how these hook i can use with your plugin class.
 * as i tried calling via setUp() method but did not worked.
 * Please advice where and how to ?
 * Regards,
 *  Plugin Author [miunosoft](https://wordpress.org/support/users/miunosoft/)
 * (@miunosoft)
 * [11 years ago](https://wordpress.org/support/topic/creating-table-on-plugin-activation/#post-6239790)
 * Hello,
 * I’m not sure if I understand your question.
 * To be clear, the framework does not have any class that helps you create your
   custom tables. You have to design your tables by yourself.
 * The framework provides means to create admin pages and forms.
 * Hope it clears it up a bit.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘creating table on plugin activation’ is closed to new replies.

 * ![](https://ps.w.org/admin-page-framework/assets/icon-256x256.png?rev=998199)
 * [Admin Page Framework](https://wordpress.org/plugins/admin-page-framework/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/admin-page-framework/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/admin-page-framework/)
 * [Active Topics](https://wordpress.org/support/plugin/admin-page-framework/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/admin-page-framework/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/admin-page-framework/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [miunosoft](https://wordpress.org/support/users/miunosoft/)
 * Last activity: [11 years ago](https://wordpress.org/support/topic/creating-table-on-plugin-activation/#post-6239790)
 * Status: resolved