Beispiel #1
1
function tweet_updater_is_tweetable($post)
{
    // retrieve the options
    $options = get_option('tweet_updater_options');
    if ($options['limit_activate']) {
        // limiter is activated, check if the post is part of
        // a category which is tweetable
        if ($options['limit_to_category'] > 0) {
            $post_categories = wp_get_post_categories($post->ID);
            if (is_array($post_categories) && sizeof($post_categories) > 0) {
                if (in_array($options['limit_to_category'], $post_categories)) {
                    echo "in cat: TRUE";
                    return true;
                }
            }
        }
        // Ok, no category found so continue with checking for the customfields
        if (!empty($options['limit_to_customfield_key']) && !empty($options['limit_to_customfield_val'])) {
            $customfield_val = get_post_meta($post->ID, $options['limit_to_customfield_key'], true);
            if (!empty($customfield_val) && $customfield_val == $options['limit_to_customfield_val']) {
                echo "fields match: true";
                return true;
            }
        }
        // in all other cases return false
        return false;
    } else {
        // limit is not active so everything is tweetable
        return true;
    }
}
function Grafik_Functions_Shortcode_TypeCategories($atts, $content = '')
{
    global $wp_query;
    global $GRAFIK_MODE;
    $callback_output = '';
    $a = shortcode_atts(array('type' => 'post', 'class' => '', 'id' => ''), $atts, 'TypeCategories');
    // Construct the query...
    $callback_query = new WP_Query(array('post_type' => $a['type'], 'posts_per_page' => -1));
    // Loop the query...
    $callback_categories = array();
    if ($callback_query->have_posts()) {
        while ($callback_query->have_posts()) {
            $callback_query->the_post();
            $callback_post = get_post();
            $callback_postcats = wp_get_post_categories($callback_post->ID);
            foreach ($callback_postcats as $key => $val) {
                $callback_categories[$val]++;
            }
        }
        wp_reset_postdata();
    } else {
        $callback_output .= '<span class="empty-message">' . $a['empty_msg'] . '</span>';
    }
    // Loop the results...
    foreach ($callback_categories as $key => $val) {
        $callback_output .= '<li class="ge-typecategories-item">' . '<a href="' . esc_url(get_category_link($key)) . '" class="ge-typecategories-link">' . '<span class="ge-typecategories-name">' . get_cat_name($key) . '</span>' . '<span class="ge-typecategories-count">' . $val . '</span>' . '</a>' . '</li>';
    }
    if (empty($callback_output)) {
        return '';
    }
    return '<div class="ge-typecategories-container' . (empty($a['class']) ? null : ' ' . $a['class']) . '"' . (empty($a['id']) ? null : ' id="' . $a['id'] . '"') . '>' . '<div class="ge-typecategories-content">' . $content . '</div>' . '<ul class="ge-typecategories-list">' . $callback_output . '</ul>' . '</div>';
}
 function cats()
 {
     foreach (wp_get_post_categories(get_the_ID()) as $c) {
         $cat = get_category($c);
         return ' - <a href="' . get_category_link($cat) . '" title="' . $cat->name . '" class="category">' . $cat->name . '</a>';
     }
 }
 /**
  * Helper function to organise parent/child categories
  */
 public static function get_post_category_hierarchy($post)
 {
     if (isset($post->taxonomy) && $post->taxonomy === 'category') {
         $post_categories = [$post->ID];
     } else {
         $post_categories = \wp_get_post_categories($post->ID);
     }
     // If just the one category, but it has a parent, add it to the array
     if (count($post_categories) === 1) {
         $category = get_category($post_categories[0]);
         if ($category && $category->parent) {
             $post_categories[] = $category->parent;
         }
     }
     $hierarchy_categories = new stdClass();
     $hierarchy_categories->child = null;
     $hierarchy_categories->parent = null;
     foreach ($post_categories as $c) {
         $cat = get_category($c);
         $category = new stdClass();
         $category->name = $cat->name;
         $category->slug = $cat->slug;
         if ($cat->parent) {
             // This is a child category
             $hierarchy_categories->child = $category;
         } else {
             $hierarchy_categories->parent = $category;
         }
     }
     return apply_filters('agreable_category_hierarchy_filter', $hierarchy_categories);
 }
 private function _meta_data($view, $params)
 {
     $defaults = array('class' => '');
     $params = wp_parse_args($params, $defaults);
     $content = '';
     // Date
     $content .= '<a href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '" class="blog_date"><i class="icon-calendar"></i>' . get_the_date('F j, Y') . '</a>';
     // Categories
     $post_categories = wp_get_post_categories(get_the_ID());
     $categories = array();
     foreach ($post_categories as $c) {
         $cat = get_category($c);
         $categories[] = '<a href="' . get_category_link($cat->term_id) . '">' . $cat->name . '</a>';
     }
     if (count($categories) > 0) {
         $content .= '<div class="blog_category"><i class="icon-tag"></i>' . implode(', ', $categories) . '</div>';
     }
     // Author
     $content .= '<span class="blog_author"><i class="icon-user"></i>' . get_the_author() . '</span>';
     $post_tags = wp_get_post_tags(get_the_ID());
     $tags = array();
     foreach ($post_tags as $tag) {
         $tags[] = '<a href="' . get_tag_link($tag->term_id) . '">' . $tag->name . '</a>';
     }
     if (count($tags) > 0) {
         $content .= '<div class="blog_category"><i class="icon-tag"></i>' . implode(', ', $tags) . '</div>';
     }
     return '<div class="' . $params['class'] . '">' . $content . '</div>';
 }
/**
 * Created by PhpStorm.
 * User: cleavesp
 * Date: 3/30/15
 * Time: 10:20 AM
 */
function ms_ajax_search_articles()
{
    global $api_access_keys;
    $target_env = $_POST['env'];
    $article_search_type = $_POST['searchtype'];
    $search_term = $_POST['searchterm'];
    $results_order_by = $_POST['orderby'];
    $args = array('post_type' => $article_search_type, 's' => $search_term, 'posts_per_page' => -1);
    $the_query = new WP_Query($args);
    $output = array();
    if ($the_query->have_posts()) {
        while ($the_query->have_posts()) {
            $the_query->the_post();
            //$html_item = ms_format_content_item_html(get_the_ID());
            //$html_item = esc_html($html_item);
            $image_attributes = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()));
            $content_categories = wp_get_post_categories(get_the_ID());
            $isCuratedLink = false;
            foreach ($content_categories as $c) {
                $cat = get_category($c);
                if ($cat->slug == 'curatedlink') {
                    $isCuratedLink = true;
                    break;
                }
            }
            array_push($output, array('title' => get_the_title(), 'body' => wp_trim_words(get_the_content(), 18), 'byline' => get_post_meta(get_the_ID(), 'byLine', true), 'sourcePubName' => get_post_meta(get_the_ID(), 'sourcePublicationName', true), 'articlePlacementId' => get_post_meta(get_the_ID(), 'articlePlacementId_en_' . $target_env, true), 'origin_url' => get_post_meta(get_the_ID(), 'originUrl', true), 'sourceId' => get_post_meta(get_the_ID(), 'sourceId', true), 'lastPublished' => get_post_meta(get_the_ID(), 'LastPublished' . $target_env, true), 'thumbnail' => $image_attributes[0], 'editlink' => get_admin_url(null, '/post.php?post=' . get_the_ID() . '&action=edit'), 'mansionid' => get_the_ID(), 'previewLink' => get_permalink(get_the_ID()), 'wordpress_post_id' => get_the_ID(), 'externalid' => get_post_meta(get_the_ID(), 'sourceId', true), 'curatedLinkId' => get_post_meta(get_the_ID(), 'curated_link_id_' . $target_env, true), 'quote' => get_post_meta(get_the_ID(), 'Quote', true), 'headline' => get_post_meta(get_the_ID(), 'Headline', true), 'sub_headline' => get_post_meta(get_the_ID(), 'Subtitle', true), 'action_url' => get_post_meta(get_the_ID(), 'Url', true), 'credit' => get_post_meta(get_the_ID(), 'credit', true), 'isCuratedLink' => $isCuratedLink));
        }
    }
    $response = array('res' => $output, 'httpCode' => '200');
    $json = json_encode($response);
    echo $json;
    die;
}
Beispiel #7
0
/**
 * adding custom body-classes
 *
 * @since   0.1
 * @created 19.01.2014, cb
 * @updated 19.01.2014, cb
 *
 * @wp-hook body_class
 * @param   Array $classes
 * @return  Array $classes
 */
function cora_filter_body_class(array $classes = array())
{
    $slug = '';
    if (is_singular()) {
        $post = get_post();
        if ($post === null) {
            return $classes;
        }
        $classes[] = $post->post_name;
        $terms = wp_get_post_categories($post->ID);
        if (!is_wp_error($terms) && !empty($terms)) {
            $term_id = $terms[0];
            $category = get_category($term_id);
            $cat_classes = cora_get_category_class_tree($category);
            $classes = array_merge($classes, $cat_classes);
        }
    } else {
        if (is_category() || is_archive()) {
            $category = get_category(get_query_var('cat'));
            $cat_classes = cora_get_category_class_tree($category);
            $classes = array_merge($classes, $cat_classes);
        }
    }
    if ($slug !== '') {
        $classes[] = 'category-' . $slug;
    }
    return $classes;
}
Beispiel #8
0
 public function map(EntityContract $entity, array $data)
 {
     $id = $data['post_parent'];
     $entity->setParent(function () use($id) {
         $parent = null;
         if ($id) {
             $parent = $this->postRepository->postOfId($id);
         }
         return $parent;
     });
     $id = $data['ID'];
     $entity->setCategories(function () use($id) {
         $categories = new Collection();
         foreach (wp_get_post_categories($id) as $termId) {
             $categories->push($this->categoryRepository->categoryOfId($termId));
         }
         return $categories;
     });
     $entity->setTags(function () use($id) {
         $tags = new Collection();
         foreach (wp_get_post_tags($id) as $termId) {
             $tags->push($this->tagRepository->tagOfId($termId));
         }
         return $tags;
     });
 }
function wos_media_categories($args)
{
    $pc = getParentCat();
    //echo $pc;
    $cat_test = get_post($_GET['attachment_id'])->post_category;
    //$categories = get_categories('hide_empty=0'); // Get all available Categories
    $categories = get_categories('child_of=' . $pc . '&hide_empty=0');
    // Get all available Categories
    $post_categories = wp_get_post_categories($_GET['attachment_id']);
    // Get this posts' Categories
    $all_cats .= '<ul id="wos-media-categories-list" style="width:500px;">';
    foreach ($categories as $category) {
        if (in_array($category->term_id, $post_categories)) {
            $chk = ' checked="checked"';
        } else {
            $chk = '';
        }
        $option = '<li style="width:240px;float:left;"><input type="checkbox" onclick="wos_category_click(this)" class="wos-categories-cb" value="' . $category->category_nicename . '" id="' . $category->category_nicename . '" name="' . $category->category_nicename . '"' . $chk . '> ';
        $option .= '<label for="' . $category->category_nicename . '">' . $category->cat_name . '</label>';
        $option .= '</li>';
        $all_cats .= $option;
    }
    $all_cats .= '</ul>';
    // Format Category fields on page
    $categories = array('all_categories' => array('label' => __('Category'), 'input' => 'html', 'html' => $all_cats));
    return array_merge($args, $categories);
}
 function prepare_schema($post_id, $schema)
 {
     $post = get_post($post_id);
     $this->content = $schema->post_content;
     $this->content = str_replace("%LINK%", $post->guid, $this->content);
     $this->content = str_replace("%TITLE%", $post->post_title, $this->content);
     $this->content = str_replace("%CONTENT%", $post->post_content, $this->content);
     $this->content = str_replace("%DATE%", $post->post_date, $this->content);
     $this->keywords = array();
     $tags = wp_get_post_tags($post_id);
     foreach ($tags as $tag) {
         array_push($this->keywords, $tags[$tag]->name);
     }
     $categories = wp_get_post_categories($post_id);
     foreach ($categories as $category) {
         $cat = get_category($category);
         array_push($this->keywords, $cat->name);
     }
     $content = str_replace("%KEYWORDS%", implode(",", $this->keywords), $this->content);
     $args = array('posts_per_page' => 9999999, 'orderby' => 'post_title', 'order' => 'ASC', 'post_type' => 'lrfield', 'post_status' => 'publish', 'suppress_filters' => true);
     $fields = get_posts($args);
     foreach ($fields as $field) {
         $this->content = str_replace("%" . strtoupper($field->post_title) . "%", $field->post_content, $this->content);
     }
 }
 public static function isAvailable()
 {
     if (is_admin()) {
         return false;
     }
     if (PrisnaGWTConfig::getSettingValue('test_mode') == 'true' && !current_user_can('administrator')) {
         return false;
     }
     global $post;
     if (!is_object($post)) {
         return true;
     }
     $settings = PrisnaGWTConfig::getSettingsValues();
     if ($post->post_type == 'page' && array_key_exists('exclude_pages', $settings)) {
         $pages = $settings['exclude_pages']['value'];
         if (in_array($post->ID, $pages)) {
             return false;
         }
     }
     if ($post->post_type == 'post' && array_key_exists('exclude_posts', $settings)) {
         $posts = $settings['exclude_posts']['value'];
         if (in_array($post->ID, $posts)) {
             return false;
         }
     }
     if ($post->post_type == 'post' && array_key_exists('exclude_categories', $settings)) {
         $categories = $settings['exclude_categories']['value'];
         $post_categories = wp_get_post_categories($post->ID);
         if (PrisnaGWTCommon::inArray($categories, $post_categories)) {
             return false;
         }
     }
     return true;
 }
Beispiel #12
0
function activity_admin_post_category_check($post_id, $post, $update)
{
    if (is_admin()) {
        if (is_plugin_active('activity/activity.php')) {
            $post_cat = wp_get_post_categories($post_id);
            if (empty($post_cat)) {
                return;
            } else {
                $activity_cat = intval(get_option('activity_category'));
                $is_post_activity = in_array($activity_cat, $post_cat);
                if ($is_post_activity) {
                    if (strpos($_SERVER['REQUEST_URI'], '/wp-admin/admin.php?page=activity_admin') === false) {
                        $post_cat = array_diff($post_cat, array($activity_cat));
                        if (empty($post_cat)) {
                            $post_cat = array(1);
                        }
                        $post_data = array('ID' => $post_id, 'post_category' => $post_cat);
                        $post_update = wp_update_post($post_data);
                        header('Location: ' . get_site_url() . '/wp-admin/admin.php?page=activity_admin&action=error_add_activity');
                        exit;
                    }
                }
            }
        }
    }
}
Beispiel #13
0
function ml_post_published_notification($post_id)
{
    $post = get_post($post_id, OBJECT);
    $alert = $post->post_title;
    $custom_properties = array('post_id' => $post_id);
    //tags
    $tags = array();
    //subscriptions
    if (ml_subscriptions_enable()) {
        $tags[] = "all";
        $capabilities = ml_subscriptions_post_capabilities($post);
        foreach ($capabilities as $c) {
            $tags[] = $c;
        }
    } else {
        $tags[] = "all";
        $categories = wp_get_post_categories($post->ID);
        foreach ($categories as $c) {
            if ($c != NULL) {
                $tags[] = $c;
            }
        }
    }
    ml_send_notification($alert, true, NULL, $custom_properties, $tags, $post_id);
}
 private function get_post()
 {
     if (isset($this->options['text_limit']) && !empty($this->options['text_limit'])) {
         $limit = $this->options['text_limit'];
     } else {
         $limit = 100;
     }
     $start_date = date('F jS, Y', strtotime($this->options['start_date']));
     $getPost = new WP_Query(array('cat' => implode(',', $this->options['categories']), 'date_query' => array(array('after' => $start_date)), 'orderby' => 'date', 'order' => 'ASC', 'meta_query' => array('relation' => 'OR', array('key' => 'aus_telegram_sent', 'compare' => 'NOT EXISTS', 'value' => '')), 'posts_per_page' => 1));
     if (isset($getPost->posts[0])) {
         $getPost = $getPost->posts[0];
         $text = $getPost->post_content;
         $text = strip_shortcodes($text);
         $text = preg_replace('/[\\r\\n]+/', "", $text);
         $text = preg_replace('/\\s+/', ' ', $text);
         $text = trim($text);
         $text = strip_tags($text);
         $text = $this->limit($text, $limit);
         $cat_ids = wp_get_post_categories($getPost->ID);
         if (!empty($cat_ids)) {
             $category = get_category($cat_ids[0])->name;
         } else {
             $category = '';
         }
         $post = array('id' => $getPost->ID, 'title' => $getPost->post_title, 'url' => $getPost->guid, 'date' => date('d.m.Y', strtotime($getPost->post_date)), 'category' => $category, 'text' => $text);
         wp_reset_query();
         return $post;
     } else {
         return false;
     }
 }
Beispiel #15
0
function get_category_meta($post_id = NULL, $cat_id = NULL)
{
    // Return array
    $final = array();
    // All category IDs
    $categories = wp_get_post_categories($post_id);
    if (isset($categories[0]) || !is_null($cat_id)) {
        $has_category = true;
        // Get the TERM for the category
        if (isset($categories[0])) {
            $term = get_term_by('id', $categories[0], "category");
            $final['cat_id'] = $categories[0];
        } else {
            $term = get_term_by('id', $cat_id, "category");
            $final['cat_id'] = $cat_id;
        }
        // Get all meta data for the Category
        $getTaxMeta = get_tax_meta($term);
        // Grab the Category COLOR
        $cat_color = $getTaxMeta['wish_dish_color'];
        // Append a # to the beginning of the color if it doesn't have one
        if (strpos($cat_color, "#") === false) {
            $cat_color = "#" . $cat_color;
        }
        $final['cat_meta'] = $getTaxMeta;
        $final['cat_color'] = $cat_color;
        $final['cat_bg_image'] = isset($getTaxMeta['wish_dish_image'][0]) ? wp_get_attachment_url($getTaxMeta['wish_dish_image'][0]) : NULL;
        return $final;
    } else {
        return false;
    }
}
function flush_jl_cat_posts_widget($post_id)
{
    $categories = wp_get_post_categories($post_id);
    foreach ($categories as $cat_id) {
        wp_cache_delete('jl_cat_posts_widget-' . $cat_id, 'widget');
    }
}
 /**
  *  Make the collage
  */
 protected function get_popular_posts()
 {
     global $post;
     $args = array('fields' => 'ids');
     $cats = wp_get_post_categories($post->ID, $args);
     $numberOfPosts = 0;
     $this->args = array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 4, 'category__in' => $cats, 'post__not_in' => array($post->ID));
     $this->PPQuery = new \WP_Query($this->args);
     $numberOfPosts = count($this->PPQuery->posts);
     //* if we don't have enough posts, lets get some off the feed
     if ($numberOfPosts < 4) {
         $postsToExclude = array();
         foreach ($this->PPQuery->posts as $p) {
             $postsToExclude[] = $p->ID;
         }
         //* make sure to exclude current post
         $postsToExclude[] = $post->ID;
         //* args for getting more posts
         $args = array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 4 - $numberOfPosts, 'post__not_in' => $postsToExclude);
         $morePosts = get_posts($args);
         //* we have to append each post
         foreach ($morePosts as $p) {
             $this->PPQuery->posts[] = $p;
         }
         //* update query args so loop knows total posts
         $this->PPQuery->found_posts = $numberOfPosts + count($morePosts);
         $this->PPQuery->post_count = $numberOfPosts + count($morePosts);
     }
 }
Beispiel #18
0
function get_blog_posts_related_by_category($post_id, $args = array())
{
    $post_categories = wp_get_post_categories($post_id);
    $args = wp_parse_args($args, array('category__in' => $post_categories, 'post__not_in' => array($post_id), 'ignore_sticky_posts' => 1, 'orderby' => 'rand', 'showposts' => 3, 'no_found_rows' => true));
    $query = new WP_Query($args);
    return $query;
}
Beispiel #19
0
function get_nested_categories($default = 0, $parent = 0)
{
    global $post_ID, $mode, $wpdb, $checked_categories;
    if (empty($checked_categories)) {
        if ($post_ID) {
            $checked_categories = wp_get_post_categories($post_ID);
            if (count($checked_categories) == 0) {
                // No selected categories, strange
                $checked_categories[] = $default;
            }
        } else {
            $checked_categories[] = $default;
        }
    }
    $cats = get_categories("parent={$parent}&hide_empty=0&fields=ids");
    $result = array();
    if (is_array($cats)) {
        foreach ($cats as $cat) {
            $result[$cat]['children'] = get_nested_categories($default, $cat);
            $result[$cat]['cat_ID'] = $cat;
            $result[$cat]['checked'] = in_array($cat, $checked_categories);
            $result[$cat]['cat_name'] = get_the_category_by_ID($cat);
        }
    }
    $result = apply_filters('get_nested_categories', $result);
    usort($result, 'sort_cats');
    return $result;
}
function get_related_posts($post_id, $items)
{
    $query = new WP_Query();
    $args = '';
    $args = wp_parse_args($args, array('showposts' => $items, 'post__not_in' => array($post_id), 'ignore_sticky_posts' => 0, 'category__in' => wp_get_post_categories($post_id)));
    $query = new WP_Query($args);
    return $query;
}
Beispiel #21
0
function porto_get_related_posts($post_id)
{
    global $porto_settings;
    $args = '';
    $args = wp_parse_args($args, array('showposts' => $porto_settings['post-related-count'], 'post__not_in' => array($post_id), 'ignore_sticky_posts' => 0, 'category__in' => wp_get_post_categories($post_id), 'orderby' => $porto_settings['post-related-orderby']));
    $query = new WP_Query($args);
    return $query;
}
 public function ct_get_categories($object, $field_name, $request)
 {
     $return = array();
     $post_categories = wp_get_post_categories($object['id']);
     foreach ($post_categories as $category) {
         $return[] = get_category($category);
     }
     return $return;
 }
/**
 * This function is called once per Post that is sent out. If the Post is sent out several times
 * then it will also be called several times. This happens if you have 20 subscribers but only send
 * 10 Mails in a batch.
 * @param int $post_id the id of the Post
 * @return array An array of replacements
 */
function post_notificataion_uf_perPost($post_id)
{
    //This is the easiest way to create array with a low possibility of errors
    $rv = array();
    $cats = wp_get_post_categories($post_id);
    $tags = wp_get_post_tags($post_id);
    $rv['@@categories'] = wp_get_post_categories($post_id);
    return $rv;
}
Beispiel #24
0
function brad_get_related_posts($post_id)
{
    global $brad_data;
    $query = new WP_Query();
    $args = '';
    $args = wp_parse_args($args, array('showposts' => intval($brad_data['blog_relatedpostsnumber']), 'post__not_in' => array($post_id), 'ignore_sticky_posts' => 0, 'category__in' => wp_get_post_categories($post_id)));
    $query = new WP_Query($args);
    return $query;
}
 function get_categories($post_id)
 {
     $cats = array();
     foreach (wp_get_post_categories($post_id) as $c) {
         $cat = get_category($c);
         $cats[] = $cat->name;
     }
     return implode(',', $cats);
 }
function ahny_update_post_terms($post_id)
{
    $post = get_post($post_id);
    if ('post' === $post->post_type) {
        $categories = wp_get_post_categories($post_id);
        $newcat = get_term_by('name', 'Living Modern', 'category');
        array_push($categories, $newcat->term_id);
        wp_set_post_categories($post_id, $categories);
    }
}
Beispiel #27
0
function category_body_class($classes)
{
    global $post;
    $post_categories = wp_get_post_categories($post->ID);
    foreach ($post_categories as $c) {
        $cat = get_category($c);
        $classes[] = 'category-' . $cat->slug;
    }
    return $classes;
}
Beispiel #28
0
 /**
  * @return array
  */
 function getCategories()
 {
     $postCategories = wp_get_post_categories($this->ID);
     $cats = array();
     foreach ($postCategories as $c) {
         $cat = get_category($c);
         $cats[] = array('name' => $cat->name, 'slug' => $cat->slug);
     }
     return $cats;
 }
Beispiel #29
0
function get_related_posts($post_id, $number_posts = -1)
{
    $query = new WP_Query();
    $args = '';
    if ($number_posts == 0) {
        return $query;
    }
    $args = wp_parse_args($args, array('posts_per_page' => $number_posts, 'post__not_in' => array($post_id), 'ignore_sticky_posts' => 0, 'meta_key' => '_thumbnail_id', 'category__in' => wp_get_post_categories($post_id)));
    $query = new WP_Query($args);
    return $query;
}
Beispiel #30
0
 public function testCreatePostWithDefaultCategoryNotYetCreated()
 {
     $taxonomy = get_taxonomy('category');
     $taxonomy->defaults = array('not a cool cat');
     do_action('registered_taxonomy', 'category');
     $post_id = $this->factory->post->create();
     $post = $this->factory->post->get_object_by_id($post_id);
     $post_categories = array_values(wp_get_post_categories($post_id, array('fields' => 'names')));
     wp_delete_post($post_id, true);
     $this->assertEqualSets($post_categories, array('Uncategorized', 'not a cool cat'));
 }