WordPress.org

Make WordPress Core

Changeset 20154


Ignore:
Timestamp:
03/08/12 11:24:43 (3 years ago)
Author:
westi
Message:

XMLRPC: Remove the "Backward Compatibility" code from the new api as we don't need to support this older format and it keeps the new api cleaner.

The new Posts API is designed so that you can fetch a post with get, update the data structure returned and submit that with edit and so we need to ensure to only include in get data in a single form - tags and categories are returned as terms.
See #18429

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-xmlrpc-server.php

    r20153 r20154  
    592592        } 
    593593 
    594         // backward compatiblity 
    595         if ( $all_taxonomy_fields || in_array( 'tags', $fields ) ) { 
    596             $tagnames = array(); 
    597             $tags = wp_get_post_tags( $post['ID'] ); 
    598             if ( ! empty( $tags ) ) { 
    599                 foreach ( $tags as $tag ) { 
    600                     $tagnames[] = $tag->name; 
    601                 } 
    602                 $tagnames = implode( ', ', $tagnames ); 
    603             } else { 
    604                 $tagnames = ''; 
    605             } 
    606             $_post['tags'] = $tagnames; 
    607         } 
    608  
    609         // backward compatiblity 
    610         if ( $all_taxonomy_fields || in_array( 'categories', $fields ) ) { 
    611             $categories = array(); 
    612             $catids = wp_get_post_categories( $post['ID'] ); 
    613             foreach ( $catids as $catid ) { 
    614                 $categories[] = get_cat_name( $catid ); 
    615             } 
    616             $_post['categories'] = $categories; 
    617         } 
    618  
    619594        if ( in_array( 'custom_fields', $fields ) ) 
    620595            $_post['custom_fields'] = $this->get_custom_fields( $post['ID'] ); 
Note: See TracChangeset for help on using the changeset viewer.