Make WordPress Core

Changeset 3849


Ignore:
Timestamp:
06/06/2006 05:04:41 AM (20 years ago)
Author:
ryan
Message:

Deprecate wp_get/set_post_cats() in favor of wp_get/set_post_categories().

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-db.php

    r3845 r3849  
    188188        $posts = $wpdb->get_col("SELECT post_id FROM $wpdb->post2cat WHERE category_id='$cat_ID'");
    189189        if ( is_array($posts) ) foreach ($posts as $post_id) {
    190                 $cats = wp_get_post_cats('', $post_id);
     190                $cats = wp_get_post_categories($post_id);
    191191                if ( 1 == count($cats) )
    192192                        $cats = array($default_cat);
    193193                else
    194194                        $cats = array_diff($cats, array($cat_ID));
    195                 wp_set_post_cats('', $post_id, $cats);
     195                wp_set_post_categories($post_id, $cats);
    196196        }
    197197
    … …  
    231231
    232232        if ($post_id)
    233                 wp_set_post_cats('', $post_id, $cat_ids);
     233                wp_set_post_categories($post_id, $cat_ids);
    234234
    235235        return $cat_ids;
  • trunk/wp-includes/deprecated.php

    r3848 r3849  
    463463}
    464464
     465function wp_get_post_cats($blogid = '1', $post_ID = 0) {
     466        return wp_get_post_categories($post_ID);
     467}
     468
     469function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) {
     470        return wp_set_post_categories($post_ID, $post_categories);
     471}
     472
    465473?>
  • trunk/wp-includes/functions-post.php

    r3843 r3849  
    162162        }
    163163
    164         wp_set_post_cats('', $post_ID, $post_category);
     164        wp_set_post_categories($post_ID, $post_category);
    165165
    166166        if ( 'page' == $post_type ) {
    … …  
    349349        }
    350350
    351         wp_set_post_cats('', $post_ID, $post_category);
     351        wp_set_post_categories($post_ID, $post_category);
    352352
    353353        if ( $file )
    … …  
    412412        // Set categories
    413413        if($mode == OBJECT) {
    414                 $post->post_category = wp_get_post_cats('',$postid);
     414                $post->post_category = wp_get_post_categories($postid);
    415415        }
    416416        else {
    417                 $post['post_category'] = wp_get_post_cats('',$postid);
     417                $post['post_category'] = wp_get_post_categories($postid);
    418418        }
    419419
    … …  
    487487}
    488488
    489 function wp_get_post_cats($blogid = '1', $post_ID = 0) {
     489function wp_get_post_categories($post_ID = 0) {
    490490        global $wpdb;
    491491
    … …  
    505505}
    506506
    507 function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) {
     507function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
    508508        global $wpdb;
    509509        // If $post_categories isn't already an array, make it one:
    … …  
    556556                wp_cache_delete($cat_id, 'category');
    557557        }
    558 }       // wp_set_post_cats()
     558}       // wp_set_post_categories()
    559559
    560560function wp_delete_post($postid = 0) {
    … …  
    571571
    572572        if ( 'publish' == $post->post_status && 'post' == $post->post_type ) {
    573                 $categories = wp_get_post_cats('', $post->ID);
     573                $categories = wp_get_post_categories($post->ID);
    574574                if( is_array( $categories ) ) {
    575575                        foreach ( $categories as $cat_id ) {
  • trunk/xmlrpc.php

    r3517 r3849  
    243243          $post_data = wp_get_single_post($post_ID, ARRAY_A);
    244244
    245           $categories = implode(',', wp_get_post_cats(1, $post_ID));
     245          $categories = implode(',', wp_get_post_categories($post_ID));
    246246
    247247          $content  = '<title>'.stripslashes($post_data['post_title']).'</title>';
    … …  
    286286         
    287287            $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
    288             $categories = implode(',', wp_get_post_cats(1, $entry['ID']));
     288            $categories = implode(',', wp_get_post_categories($entry['ID']));
    289289
    290290            $content  = '<title>'.stripslashes($entry['post_title']).'</title>';
    … …  
    696696
    697697            $categories = array();
    698             $catids = wp_get_post_cats('', $post_ID);
     698            $catids = wp_get_post_categories($post_ID);
    699699            foreach($catids as $catid) {
    700700              $categories[] = get_cat_name($catid);
    … …  
    756756            $post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
    757757            $categories = array();
    758             $catids = wp_get_post_cats('', $entry['ID']);
     758            $catids = wp_get_post_categories($entry['ID']);
    759759            foreach($catids as $catid) {
    760760              $categories[] = get_cat_name($catid);
    … …  
    959959
    960960          $categories = array();
    961           $catids = wp_get_post_cats('', intval($post_ID));
     961          $catids = wp_get_post_categories(intval($post_ID));
    962962          // first listed category will be the primary category
    963963          $isPrimary = true;
    … …  
    997997          }
    998998
    999           wp_set_post_cats('', $post_ID, $catids);
     999          wp_set_post_categories($post_ID, $catids);
    10001000
    10011001          return true;
    … …  
    10801080
    10811081          // retain old cats
    1082           $cats = wp_get_post_cats('',$post_ID);
     1082          $cats = wp_get_post_categories($post_ID);
    10831083          $postdata['post_category'] = $cats;
    10841084                $this->escape($postdata);
Note: See TracChangeset for help on using the changeset viewer.