WordPress Plugin Development tutorial from scratch (Part 17) WordPress Update/Delete to Database

In this video session i have explained about,
1. Update data of wordpress table in wordpress, 2. Delete data from wordpress table in wordpress


All we have seen in 2 different ways by using core function as well as by running direct query.

Steps to do Update data of WordPress table:
#1: wpdb::update( string $table, array $data, array $where, array|string $format = null, array|string $where_format = null )
#2: wpdb::query and wpdb::prepare

Steps to do Delete data from WordPress table:
#1: wpdb::delete( string $table, array $where, array|string $where_format = null )
#2: wpdb::query and wpdb::prepare

By Step $wpdb::update,
1. wpdb::update( ‘table’, array( ‘column’ = ‘foo’, ‘field’ = ‘bar’ ), array( ‘ID’ = 1 ) )
2. wpdb::update( ‘table’, array( ‘column’ = ‘foo’, ‘field’ = 1337 ), array( ‘ID’ = 1 ), array( ‘%s’, ‘%d’ ), array( ‘%d’ ) )

‘table’: table_name of wordpress database

By Step $wpdb::delete,
1. wpdb::delete( ‘table’, array( ‘ID’ = 1 ) )
2. wpdb::delete( ‘table’, array( ‘ID’ = 1 ), array( ‘%d’ ) )

‘table’: table_name of wordpress database

By Step $wpdb::query,
We have to use $wpdb::prepare to make Safe Execution of MySql Query
“Update wp_custom_plugin set email = ‘%s’ where id = %d”,’[email protected]’,4

“Delete from wp_custom_plugin where id = %d”,4

An array of formats to be mapped to each of the value in $data. If string, that format will be used for all of the values in $data. A format is one of ‘%d’, ‘%f’, ‘%s’ (integer, float, string).

Documenation Study Notes:




Create database table dynamically by WordPress Plugin,
Click here to watch: https://www.youtube.com/watch?v=nzRyFF95jXI

How we add custom javascript code to wordpress plugin page:
Click here to watch: https://www.youtube.com/watch?v=CUt8trEQkPc

Subscribe : https://www.youtube.com/channel/UCB2flCo-gW6RhpVVXySqcMg
FACEBOOK : https://www.facebook.com/onlinewebtutorhub/
TWITTER: https://twitter.com/owthub
BLOG: https://onlinewebtutorhub.blogspot.in/

1. Some knowledge of PHP, HTML for this video series
2. How to Install WordPress: https://www.youtube.com/watch?v=MREgql9jmf0

Also you can learn WordPress Custom
Theme Development: https://www.youtube.com/watch?v=MREgql9jmf0&list=PLT9miexWCpPV9WxY_QG3qxUGKzw54LboW
Widget Development: https://www.youtube.com/watch?v=ZSbdYG1svV8&list=PLT9miexWCpPUgibUXDZ7JP1j3U-m61U8m

online web tutor,
profotech solutions,
wordpress plugin development from scratch in hindi,
wordpress plugin development from scratch in easy steps,
wordpress plugin development,
wordpress plugin development in easy steps,
plugin development in wordpress from scratch in hindi,
plugin development in wordpress by online web tutor,
plugin development in wordpress tutorials from scratch in hindi,
plugin theme development tutorials in hindi,
plugin development tutorials in hindi,
owt tuts,
online web tutorials,

Online Web Tutor
Keep learning and Sharing 🙂

Please watch: “Learn backbone.js tutorial from scratch”


About admin

Leave a Reply

Your email address will not be published. Required fields are marked *