The Database Object in WordPress
You can access the database via WordPress. You can use any raw SQL too. That is quite easy. You only need to call a global object;
global $wpdb;
For the raw SQL, you can use query method:
$wpdb->query(
"
UPDATE $wpdb->posts
SET post_parent = 10
WHERE ID = 15
"
);
For get the record set,
$drafts = $wpdb->get_results(
"
SELECT *
FROM $wpdb->posts
WHERE post_status = 'draft'
AND post_author =1
"
);
There are insert, update and delete method too.
Please read WordPress development documentation for the further information
Tags: wordpress
Trackback address for this post
Trackback URL (right click and copy shortcut/link location)
Feedback awaiting moderation
This post has 1309 feedbacks awaiting moderation...
Form is loading...