Skip to content

Instantly share code, notes, and snippets.

@alexkingorg
Created July 13, 2013 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexkingorg/5991297 to your computer and use it in GitHub Desktop.
Save alexkingorg/5991297 to your computer and use it in GitHub Desktop.
Convert existing threads and categories to projects.
<?php
function akv3_convert_to_projects() {
global $wpdb;
// convert categories
$wpdb->query("
UPDATE wp_term_taxonomy
SET taxonomy = 'projects',
parent = 0
WHERE term_id IN (13, 14, 15, 20, 22, 52, 53, 58, 59)
");
// convert threads
$wpdb->query("
UPDATE wp_term_taxonomy
SET taxonomy = 'projects',
parent = 0
WHERE term_id IN (400, 417, 438, 455)
");
$wpdb->query("
UPDATE wp_posts
SET post_type = 'project'
WHERE ID IN (15866, 15874, 15876, 15878)
");
$wpdb->query("
UPDATE wp_postmeta
SET meta_key = '_cf-tax-post-binding_projects'
WHERE meta_key = '_cf-tax-post-binding_threads'
AND post_id IN (15866, 15874, 15876, 15878)
");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment