//Code to Export Business Terms and terms to migrate too
$posts = get_posts(array(
'post_type' => 'u',
'numberposts' => -1
));
$count = count($posts);
echo "
<h3>Export Business Categories</h3>
<span class='total'>Total Users: {$count}</span>
<table>
<tr>
<th>Business ID</th>
<th>Business Name</th>
<th>User Tags</th>
<th>Categories</th>
</tr>";
foreach($posts as $post) {
$post_id = $post->ID;
$name = $post->post_title;
$terms = get_the_terms($post_id, 'ut');
$termIDs = wp_list_pluck($terms, "term_id");
$term_ids_strings = implode(", ",$termIDs);
$termNames = wp_list_pluck($terms, "name");
$term_names_string = implode(", ", $termNames);
$newtermList = [];
foreach($termNames as $t_name) {
$newTerm = get_term_by('name', $t_name, 'category');
if($newTerm == false) { continue; }
if($newTerm->parent != 0) {
$parentName = get_term_by('ID', $newTerm->parent, 'category');
$string = $parentName->name.">".$newTerm->name;
if($parentName->parent != 0) {
$parentName2 = get_term_by('ID', $parentName->parent, 'category');
$string = $parentName2->name.">".$parentName->name.">".$newTerm->name;
array_push($newtermList, $string);
continue;
}
array_push($newtermList, $string);
continue;
}
array_push($newtermList, $newTerm->name);
}
$new_terms_string = implode(", ", $newtermList);
echo "
<tr>
<td>{$post_id}</td>
<td>{$name}</td>
<td>{$term_names_string}</td>
<td>{$new_terms_string}</td>
</tr>
";
}
echo "</table>";
Search Knowledge Base Articles
Vegas Best Awards Business Terms Migration
Did you find this article useful?
Related Articles
-
Creating a New cPanel Account on WHM
Step 1: Log InLogin into the desired WHM accountStep 2: In WHM Dashboard Select "Create a New Account"Step 3: Domain InformationThe domain information... -
Privacy Policy Online Generator
Here is an online generator for a Privacy Policy:https://www.privacypolicygenerator.info/... -
Terms & Conditions Online Generator
Here's an online generator for "Terms & Conditions":https://www.termsandconditionsgenerator.com/You will have to spell-check because there are typ... -
WooCommerce Constant Loading on Credit Card Section
If after putting location in when checking out, and the credit card section keeps spinning, chances are you have to turn off and on the "mod_security2... -
Client not receiving emails from form on website.
The solution for this should be SPF record or if that doesn't work smtp issue. SPF record example: v=spf1 a mx ip4:xxx.xxx.xxx.xxx -allre...