Ticket #16003: wp_category_ids.diff

File wp_category_ids.diff, 1.6 KB (added by ericmann, 2 years ago)

Adds support for using an array of category IDs.

Line 
1Index: wp-includes/class-wp-xmlrpc-server.php
2===================================================================
3--- wp-includes/class-wp-xmlrpc-server.php      (revision 17246)
4+++ wp-includes/class-wp-xmlrpc-server.php      (working copy)
5@@ -2303,7 +2303,15 @@
6                                }
7                        }
8                }
9+               if ( isset( $content_struct['wp_category_ids'] ) ) {
10+                       $catids = $content_struct['wp_category_ids'];
11+                       logIO('O', 'Post cat ids: ' . var_export($catids, true));
12 
13+                       if ( is_array($catids) ) {
14+                               $post_category = array_merge( $post_category, array_diff( $catids, $post_category ) );
15+                       }
16+               }
17+
18                // We've got all the data -- post it:
19                $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping', 'post_type', 'post_name', 'post_password', 'post_parent', 'menu_order', 'tags_input', 'page_template');
20 
21@@ -2755,6 +2763,7 @@
22                                // commented out because no other tool seems to use this
23                                //            'content' => $entry['post_content'],
24                                'categories' => $categories,
25+                               'wp_category_ids' => $catids,
26                                'mt_excerpt' => $postdata['post_excerpt'],
27                                'mt_text_more' => $post['extended'],
28                                'mt_allow_comments' => $allow_comments,
29@@ -2865,6 +2874,7 @@
30                                // commented out because no other tool seems to use this
31                                // 'content' => $entry['post_content'],
32                                'categories' => $categories,
33+                               'wp_category_ids' => $catids,
34                                'mt_excerpt' => $entry['post_excerpt'],
35                                'mt_text_more' => $post['extended'],
36                                'mt_allow_comments' => $allow_comments,