|
@@ -317,13 +317,14 @@ class WordPressImport {
|
|
|
|
|
|
|
|
if (!empty($postIds)) {
|
|
if (!empty($postIds)) {
|
|
|
$placeholders = str_repeat('?,', count($postIds) - 1) . '?';
|
|
$placeholders = str_repeat('?,', count($postIds) - 1) . '?';
|
|
|
- $categoriesStmt = $this->wpDb->query("
|
|
|
|
|
|
|
+ $categoriesStmt = $this->wpDb->prepare("
|
|
|
SELECT tr.object_id as post_id, t.name as category_name
|
|
SELECT tr.object_id as post_id, t.name as category_name
|
|
|
FROM wp_term_relationships tr
|
|
FROM wp_term_relationships tr
|
|
|
JOIN wp_term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id
|
|
JOIN wp_term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id
|
|
|
JOIN wp_terms t ON tt.term_id = t.term_id
|
|
JOIN wp_terms t ON tt.term_id = t.term_id
|
|
|
WHERE tt.taxonomy = 'category' AND tr.object_id IN ($placeholders)
|
|
WHERE tt.taxonomy = 'category' AND tr.object_id IN ($placeholders)
|
|
|
- ", $postIds);
|
|
|
|
|
|
|
+ ");
|
|
|
|
|
+ $categoriesStmt->execute($postIds);
|
|
|
|
|
|
|
|
foreach ($categoriesStmt->fetchAll() as $cat) {
|
|
foreach ($categoriesStmt->fetchAll() as $cat) {
|
|
|
$categoriesMap[$cat['post_id']][] = $cat['category_name'];
|
|
$categoriesMap[$cat['post_id']][] = $cat['category_name'];
|