Skip to content

Instantly share code, notes, and snippets.

@alexkingorg
Created July 13, 2013 17:16
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/5991399 to your computer and use it in GitHub Desktop.
Save alexkingorg/5991399 to your computer and use it in GitHub Desktop.
Apply projects to existing posts.
<?php
function akv3_apply_projects_terms() {
$project_posts = array();
$project_posts['threads'] = array(16176);
$project_posts['carrington-build'] = array(16291, 13738, 5657, 5608, 4956, 4547, 4556, 4509);
$project_posts['carrington-core'] = array(12784, 14179, 13830, 13730, 13602, 12784, 5168, 5058, 4507, 4343, 3968, 3576, 3566, 3549, 3536, 3512, 3454, 3424, 3391, 3314, 3315, 3303, 3294, 3290, 3283, 3260, 3233, 3228, 3219, 3208);
$project_posts['sharethis'] = array(3133, 3012, 2979, 2948, 2603, 2704, 2681, 2627, 2600, 2620, 2595, 2568, 2581, 2577, 2535, 2511, 2032, 2484);
// lots more here, truncated for sanity
foreach ($project_posts as $project => $post_ids) {
foreach ($post_ids as $post_id) {
wp_set_object_terms($post_id, $project, 'projects', true);
wp_set_object_terms($post_id, 'projects', 'category', true);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment