Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed import (and attach) categories from superdesk to WP. #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@
$categoryExist = $wpdb->get_row("SELECT terms.term_id, term_taxonomy.term_taxonomy_id FROM " . $wpdb->prefix . "terms terms JOIN " . $wpdb->prefix . "term_taxonomy term_taxonomy ON term_taxonomy.term_id = terms.term_id WHERE term_taxonomy.taxonomy = 'category' AND terms.name = '" . wp_strip_all_tags($subject['name']) . "'");

if ($categoryExist) {
$taxonomyCategory[] = $categoryExist->term_taxonomy_id;
$taxonomyCategory[] = $categoryExist->term_id;
} else {
$category_id = wp_insert_term(wp_strip_all_tags($subject['name']), 'category');
$taxonomyCategory[] = $category_id['term_taxonomy_id'];
$taxonomyCategory[] = $category_id['term_id'];
}
}
}
Expand All @@ -107,10 +107,10 @@
$categoryExist = $wpdb->get_row("SELECT terms.term_id, term_taxonomy.term_taxonomy_id FROM " . $wpdb->prefix . "terms terms JOIN " . $wpdb->prefix . "term_taxonomy term_taxonomy ON term_taxonomy.term_id = terms.term_id WHERE term_taxonomy.taxonomy = 'category' AND terms.name = '" . wp_strip_all_tags($service['name']) . "'");

if ($categoryExist) {
$taxonomyCategory[] = $categoryExist->term_taxonomy_id;
$taxonomyCategory[] = $categoryExist->term_id;
} else {
$category_id = wp_insert_term(wp_strip_all_tags($service['name']), 'category');
$taxonomyCategory[] = $category_id['term_taxonomy_id'];
$taxonomyCategory[] = $category_id['term_id'];
}
}
}
Expand Down