0

I am creating a new blog post Plugin in Wordpress form Created Successfully how to Store the form data in database

register_activation_hook(__FILE__,'create_books_table');
register_deactivation_hook(__FILE__,'truncate_book_table');
add_action('init','book_assets');
add_action("admin_menu", "my_book_plugin_menus");

enter image description here

1 Answer 1

1

Here is a example of how to insert data to database using $wpdb.

  global $wpdb;

  $wpdb->insert( 
    'table_name_here', 
    array( 
        'column1' => 'value1', 
        'column2' => 123 
    ), 
    array( 
        '%s', 
        '%d' 
    ) 
 );

Visit https://codex.wordpress.org/Creating_Tables_with_Plugins for more .

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.