Quote values heading to DB. Cast some ints.
git-svn-id: https://develop.svn.wordpress.org/trunk@5029 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
02f3720bfa
commit
71bbe5ffb4
@ -469,9 +469,11 @@ function wp_set_link_cats($link_ID = 0, $link_categories = array()) {
|
||||
|
||||
if ($add_cats) {
|
||||
foreach ($add_cats as $new_cat) {
|
||||
$wpdb->query("
|
||||
INSERT INTO $wpdb->link2cat (link_id, category_id)
|
||||
VALUES ($link_ID, $new_cat)");
|
||||
$new_cat = (int) $new_cat;
|
||||
if ( !empty($new_cat) )
|
||||
$wpdb->query("
|
||||
INSERT INTO $wpdb->link2cat (link_id, category_id)
|
||||
VALUES ('$link_ID', '$new_cat')");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -802,10 +802,11 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
|
||||
|
||||
if ($add_cats) {
|
||||
foreach ($add_cats as $new_cat) {
|
||||
$new_cat = (int) $new_cat;
|
||||
if ( !empty($new_cat) )
|
||||
$wpdb->query("
|
||||
INSERT INTO $wpdb->post2cat (post_id, category_id)
|
||||
VALUES ($post_ID, $new_cat)");
|
||||
VALUES ('$post_ID', '$new_cat')");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user