<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[21651] trunk: Add tags_input, page_template, and post_category get magic to WP_Post.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/21651">21651</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2012-08-28 19:08:28 +0000 (Tue, 28 Aug 2012)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add tags_input, page_template, and post_category get magic to WP_Post.
Deprecate get_post_to_edit() and wp_get_single_post().
Props scribu
see <a href="http://core.trac.wordpress.org/ticket/21309">#21309</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesdeprecatedphp">trunk/wp-admin/includes/deprecated.php</a></li>
<li><a href="#trunkwpadminincludespostphp">trunk/wp-admin/includes/post.php</a></li>
<li><a href="#trunkwpadminpostphp">trunk/wp-admin/post.php</a></li>
<li><a href="#trunkwpincludesclasswpatomserverphp">trunk/wp-includes/class-wp-atom-server.php</a></li>
<li><a href="#trunkwpincludesclasswpxmlrpcserverphp">trunk/wp-includes/class-wp-xmlrpc-server.php</a></li>
<li><a href="#trunkwpincludesdeprecatedphp">trunk/wp-includes/deprecated.php</a></li>
<li><a href="#trunkwpincludespostphp">trunk/wp-includes/post.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesdeprecatedphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/deprecated.php (21650 => 21651)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/deprecated.php        2012-08-28 18:48:50 UTC (rev 21650)
+++ trunk/wp-admin/includes/deprecated.php        2012-08-28 19:08:28 UTC (rev 21651)
</span><span class="lines">@@ -943,7 +943,7 @@
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * This was once used to display an 'Insert into Post' button. Now it is deprecated and stubbed.
</span><del>- *
</del><ins>+ *
</ins><span class="cx"> * @deprecated 3.5.0
</span><span class="cx"> */
</span><span class="cx"> function _insert_into_post_button( $type ) {
</span><span class="lines">@@ -952,9 +952,25 @@
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * This was once used to display a media button. Now it is deprecated and stubbed.
</span><del>- *
</del><ins>+ *
</ins><span class="cx"> * @deprecated 3.5.0
</span><span class="cx"> */
</span><span class="cx"> function _media_button($title, $icon, $type, $id) {
</span><span class="cx">         _deprecated_function( __FUNCTION__, '3.5' );
</span><span class="cx"> }
</span><ins>+
+/**
+ * Get an existing post and format it for editing.
+ *
+ * @since 2.0.0
+ * @deprecated 3.5.0
+ *
+ * @param int $id
+ * @return object
+ */
+function get_post_to_edit( $id ) {
+        _deprecated_function( __FUNCTION__, '3.5', 'get_post()' );
+
+        return get_post( $id, OBJECT, 'edit' );
+}
+
</ins></span></pre></div>
<a id="trunkwpadminincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/post.php (21650 => 21651)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/post.php        2012-08-28 18:48:50 UTC (rev 21650)
+++ trunk/wp-admin/includes/post.php        2012-08-28 19:08:28 UTC (rev 21651)
</span><span class="lines">@@ -464,24 +464,6 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Get an existing post and format it for editing.
- *
- * @since 2.0.0
- *
- * @param int $id
- * @return WP_Post
- */
-function get_post_to_edit( $id ) {
-
-        $post = get_post( $id, OBJECT, 'edit' );
-
-        if ( $post->post_type == 'page' )
-                $post->page_template = get_post_meta( $id, '_wp_page_template', true );
-
-        return $post;
-}
-
-/**
</del><span class="cx"> * Determine if a post exists based on title, content, and date
</span><span class="cx"> *
</span><span class="cx"> * @since 2.0.0
</span><span class="lines">@@ -928,7 +910,7 @@
</span><span class="cx"> /**
</span><span class="cx"> * Executes a query for attachments. An array of WP_Query arguments
</span><span class="cx"> * can be passed in, which will override the arguments set by this function.
</span><del>- *
</del><ins>+ *
</ins><span class="cx"> * @since 2.5.0
</span><span class="cx"> * @uses apply_filters() Calls 'upload_per_page' on posts_per_page argument
</span><span class="cx"> *
</span></span></pre></div>
<a id="trunkwpadminpostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/post.php (21650 => 21651)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/post.php        2012-08-28 18:48:50 UTC (rev 21650)
+++ trunk/wp-admin/post.php        2012-08-28 19:08:28 UTC (rev 21651)
</span><span class="lines">@@ -165,7 +165,7 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         $title = $post_type_object->labels->edit_item;
</span><del>-        $post = get_post_to_edit($post_id);
</del><ins>+        $post = get_post($post_id, OBJECT, 'edit');
</ins><span class="cx">
</span><span class="cx">         if ( post_type_supports($post_type, 'comments') ) {
</span><span class="cx">                 wp_enqueue_script('admin-comments');
</span></span></pre></div>
<a id="trunkwpincludesclasswpatomserverphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class-wp-atom-server.php (21650 => 21651)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-wp-atom-server.php        2012-08-28 18:48:50 UTC (rev 21650)
+++ trunk/wp-includes/class-wp-atom-server.php        2012-08-28 19:08:28 UTC (rev 21651)
</span><span class="lines">@@ -913,7 +913,7 @@
</span><span class="cx">                         $this->not_found();
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                $entry = wp_get_single_post($postID,ARRAY_A);
</del><ins>+                $entry = get_post($postID,ARRAY_A);
</ins><span class="cx">
</span><span class="cx">                 if (!isset($entry) || !isset($entry['ID']))
</span><span class="cx">                         $this->not_found();
</span><span class="lines">@@ -1410,7 +1410,7 @@
</span><span class="cx">                 switch($this->params[0]) {
</span><span class="cx">                         case $this->ENTRY_PATH:
</span><span class="cx">                                 global $post;
</span><del>-                                $post = wp_get_single_post($this->params[1]);
</del><ins>+                                $post = get_post($this->params[1]);
</ins><span class="cx">                                 $wp_last_modified = get_post_modified_time('D, d M Y H:i:s', true);
</span><span class="cx">                                 $post = null;
</span><span class="cx">                                 break;
</span></span></pre></div>
<a id="trunkwpincludesclasswpxmlrpcserverphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class-wp-xmlrpc-server.php (21650 => 21651)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-wp-xmlrpc-server.php        2012-08-28 18:48:50 UTC (rev 21650)
+++ trunk/wp-includes/class-wp-xmlrpc-server.php        2012-08-28 19:08:28 UTC (rev 21651)
</span><span class="lines">@@ -1256,7 +1256,7 @@
</span><span class="cx">
</span><span class="cx">                 do_action( 'xmlrpc_call', 'wp.deletePost' );
</span><span class="cx">
</span><del>-                $post = wp_get_single_post( $post_id, ARRAY_A );
</del><ins>+                $post = get_post( $post_id, ARRAY_A );
</ins><span class="cx">                 if ( empty( $post['ID'] ) )
</span><span class="cx">                         return new IXR_Error( 404, __( 'Invalid post ID.' ) );
</span><span class="cx">
</span><span class="lines">@@ -1286,7 +1286,7 @@
</span><span class="cx">          * groups are 'post' (all basic fields), 'taxonomies', 'custom_fields',
</span><span class="cx">          * and 'enclosure'.
</span><span class="cx">          *
</span><del>-         * @uses wp_get_single_post()
</del><ins>+         * @uses get_post()
</ins><span class="cx">          * @param array $args Method parameters. Contains:
</span><span class="cx">          * - int $post_id
</span><span class="cx">          * - string $username
</span><span class="lines">@@ -1337,7 +1337,7 @@
</span><span class="cx">
</span><span class="cx">                 do_action( 'xmlrpc_call', 'wp.getPost' );
</span><span class="cx">
</span><del>-                $post = wp_get_single_post( $post_id, ARRAY_A );
</del><ins>+                $post = get_post( $post_id, ARRAY_A );
</ins><span class="cx">
</span><span class="cx">                 if ( empty( $post['ID'] ) )
</span><span class="cx">                         return new IXR_Error( 404, __( 'Invalid post ID.' ) );
</span><span class="lines">@@ -2060,7 +2060,7 @@
</span><span class="cx">
</span><span class="cx">                 // Get the current page based on the page_id and
</span><span class="cx">                 // make sure it is a page and not a post.
</span><del>-                $actual_page = wp_get_single_post($page_id, ARRAY_A);
</del><ins>+                $actual_page = get_post($page_id, ARRAY_A);
</ins><span class="cx">                 if ( !$actual_page || ($actual_page['post_type'] != 'page') )
</span><span class="cx">                         return(new IXR_Error(404, __('Sorry, no such page.')));
</span><span class="cx">
</span><span class="lines">@@ -2101,7 +2101,7 @@
</span><span class="cx">                 do_action('xmlrpc_call', 'wp.editPage');
</span><span class="cx">
</span><span class="cx">                 // Get the page data and make sure it is a page.
</span><del>-                $actual_page = wp_get_single_post($page_id, ARRAY_A);
</del><ins>+                $actual_page = get_post($page_id, ARRAY_A);
</ins><span class="cx">                 if ( !$actual_page || ($actual_page['post_type'] != 'page') )
</span><span class="cx">                         return(new IXR_Error(404, __('Sorry, no such page.')));
</span><span class="cx">
</span><span class="lines">@@ -3296,7 +3296,7 @@
</span><span class="cx">                 if ( !$user = $this->login($username, $password) )
</span><span class="cx">                         return $this->error;
</span><span class="cx">
</span><del>-                $post_data = wp_get_single_post($post_ID, ARRAY_A);
</del><ins>+                $post_data = get_post($post_ID, ARRAY_A);
</ins><span class="cx">                 if ( ! $post_data )
</span><span class="cx">                         return new IXR_Error( 404, __( 'Invalid post ID.' ) );
</span><span class="cx">
</span><span class="lines">@@ -3538,7 +3538,7 @@
</span><span class="cx">
</span><span class="cx">                 do_action('xmlrpc_call', 'blogger.editPost');
</span><span class="cx">
</span><del>-                $actual_post = wp_get_single_post($post_ID,ARRAY_A);
</del><ins>+                $actual_post = get_post($post_ID,ARRAY_A);
</ins><span class="cx">
</span><span class="cx">                 if ( !$actual_post || $actual_post['post_type'] != 'post' )
</span><span class="cx">                         return new IXR_Error(404, __('Sorry, no such post.'));
</span><span class="lines">@@ -3592,7 +3592,7 @@
</span><span class="cx">
</span><span class="cx">                 do_action('xmlrpc_call', 'blogger.deletePost');
</span><span class="cx">
</span><del>-                $actual_post = wp_get_single_post($post_ID,ARRAY_A);
</del><ins>+                $actual_post = get_post($post_ID,ARRAY_A);
</ins><span class="cx">
</span><span class="cx">                 if ( !$actual_post || $actual_post['post_type'] != 'post' )
</span><span class="cx">                         return new IXR_Error(404, __('Sorry, no such post.'));
</span><span class="lines">@@ -3982,7 +3982,7 @@
</span><span class="cx">
</span><span class="cx">                 do_action('xmlrpc_call', 'metaWeblog.editPost');
</span><span class="cx">
</span><del>-                $postdata = wp_get_single_post( $post_ID, ARRAY_A );
</del><ins>+                $postdata = get_post( $post_ID, ARRAY_A );
</ins><span class="cx">
</span><span class="cx">                 // If there is no post data for the give post id, stop
</span><span class="cx">                 // now and return an error. Other wise a new post will be
</span><span class="lines">@@ -4247,7 +4247,7 @@
</span><span class="cx">                 if ( !$user = $this->login($username, $password) )
</span><span class="cx">                         return $this->error;
</span><span class="cx">
</span><del>-                $postdata = wp_get_single_post($post_ID, ARRAY_A);
</del><ins>+                $postdata = get_post($post_ID, ARRAY_A);
</ins><span class="cx">                 if ( ! $postdata )
</span><span class="cx">                         return new IXR_Error( 404, __( 'Invalid post ID.' ) );
</span><span class="cx">
</span><span class="lines">@@ -4827,7 +4827,7 @@
</span><span class="cx">
</span><span class="cx">                 do_action('xmlrpc_call', 'mt.getTrackbackPings');
</span><span class="cx">
</span><del>-                $actual_post = wp_get_single_post($post_ID, ARRAY_A);
</del><ins>+                $actual_post = get_post($post_ID, ARRAY_A);
</ins><span class="cx">
</span><span class="cx">                 if ( !$actual_post )
</span><span class="cx">                         return new IXR_Error(404, __('Sorry, no such post.'));
</span><span class="lines">@@ -4874,7 +4874,7 @@
</span><span class="cx">
</span><span class="cx">                 do_action('xmlrpc_call', 'mt.publishPost');
</span><span class="cx">
</span><del>-                $postdata = wp_get_single_post($post_ID, ARRAY_A);
</del><ins>+                $postdata = get_post($post_ID, ARRAY_A);
</ins><span class="cx">                 if ( ! $postdata )
</span><span class="cx">                         return new IXR_Error( 404, __( 'Invalid post ID.' ) );
</span><span class="cx">
</span><span class="lines">@@ -5088,7 +5088,7 @@
</span><span class="cx">                          return new IXR_Error(33, __('The specified target URL cannot be used as a target. It either doesn&#8217;t exist, or it is not a pingback-enabled resource.'));
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                $actual_post = wp_get_single_post($post_ID, ARRAY_A);
</del><ins>+                $actual_post = get_post($post_ID, ARRAY_A);
</ins><span class="cx">
</span><span class="cx">                 if ( !$actual_post ) {
</span><span class="cx">                         // No such post = resource not found
</span></span></pre></div>
<a id="trunkwpincludesdeprecatedphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/deprecated.php (21650 => 21651)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/deprecated.php        2012-08-28 18:48:50 UTC (rev 21650)
+++ trunk/wp-includes/deprecated.php        2012-08-28 19:08:28 UTC (rev 21651)
</span><span class="lines">@@ -3203,4 +3203,24 @@
</span><span class="cx"> */
</span><span class="cx"> function _get_post_ancestors( &$post ) {
</span><span class="cx">         _deprecated_function( __FUNCTION__, '3.5' );
</span><del>-}
</del><span class="cx">\ No newline at end of file
</span><ins>+}
+
+/**
+ * Retrieve a single post, based on post ID.
+ *
+ * Has categories in 'post_category' property or key. Has tags in 'tags_input'
+ * property or key.
+ *
+ * @since 1.0.0
+ * @deprecated 3.5.0
+ * @see get_post()
+ *
+ * @param int $postid Post ID.
+ * @param string $mode How to return result, either OBJECT, ARRAY_N, or ARRAY_A.
+ * @return object|array Post object or array holding post contents and information
+ */
+function wp_get_single_post( $postid = 0, $mode = OBJECT ) {
+        _deprecated_function( __FUNCTION__, '3.5', 'get_post()' );
+        return get_post( $postid, $mode, 'edit' );
+}
+
</ins></span></pre></div>
<a id="trunkwpincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/post.php (21650 => 21651)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/post.php        2012-08-28 18:48:50 UTC (rev 21650)
+++ trunk/wp-includes/post.php        2012-08-28 19:08:28 UTC (rev 21651)
</span><span class="lines">@@ -475,10 +475,44 @@
</span><span class="cx">                 if ( 'ancestors' == $key )
</span><span class="cx">                         return true;
</span><span class="cx">
</span><ins>+                if ( 'page_template' == $key )
+                        return ( 'page' == $this->post_type );
+
+                if ( 'post_category' == $key )
+                 return true;
+
+                if ( 'tags_input' == $key )
+                 return true;
+
</ins><span class="cx">                 return metadata_exists( 'post', $this->ID, $key );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         public function &__get( $key ) {
</span><ins>+                if ( 'page_template' == $key && $this->__isset( $key ) ) {
+                        $_ref = get_post_meta( $this->ID, '_wp_page_template', true );
+                }
+
+                if ( 'post_category' == $key ) {
+                        if ( is_object_in_taxonomy( $this->post_type, 'category' ) ) {
+                                $_ref = wp_get_post_categories( $this->ID );
+                        } else {
+                                $_ref = array();
+                        }
+                }
+
+                if ( 'tags_input' == $key ) {
+                        if ( is_object_in_taxonomy( $this->post_type, 'post_tag' ) ) {
+                                $_ref = wp_get_post_tags( $this->ID, array( 'fields' => 'names' ) );
+                        } else {
+                                $_ref = array();
+                        }
+                }
+
+                if ( isset( $_ref ) )
+                        return $_ref;
+
+                // Rest of the values need filtering
+
</ins><span class="cx">                 if ( 'ancestors' == $key ) {
</span><span class="cx">                         $value = get_post_ancestors( $this );
</span><span class="cx">                 } else {
</span><span class="lines">@@ -504,8 +538,12 @@
</span><span class="cx">
</span><span class="cx">         public function to_array() {
</span><span class="cx">                 $post = get_object_vars( $this );
</span><del>-                $post['ancestors'] = array();
</del><span class="cx">
</span><ins>+                foreach ( array( 'ancestors', 'page_template', 'post_category', 'tags_input' ) as $key ) {
+                        if ( $this->__isset( $key ) )
+                                $post[ $key ] = $this->__get( $key );
+                }
+
</ins><span class="cx">                 return $post;
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="lines">@@ -2226,7 +2264,7 @@
</span><span class="cx">         if ( !EMPTY_TRASH_DAYS )
</span><span class="cx">                 return wp_delete_post($post_id, true);
</span><span class="cx">
</span><del>-        if ( !$post = wp_get_single_post($post_id, ARRAY_A) )
</del><ins>+        if ( !$post = get_post($post_id, ARRAY_A) )
</ins><span class="cx">                 return $post;
</span><span class="cx">
</span><span class="cx">         if ( $post['post_status'] == 'trash' )
</span><span class="lines">@@ -2258,7 +2296,7 @@
</span><span class="cx"> * @return mixed False on failure
</span><span class="cx"> */
</span><span class="cx"> function wp_untrash_post($post_id = 0) {
</span><del>-        if ( !$post = wp_get_single_post($post_id, ARRAY_A) )
</del><ins>+        if ( !$post = get_post($post_id, ARRAY_A) )
</ins><span class="cx">                 return $post;
</span><span class="cx">
</span><span class="cx">         if ( $post['post_status'] != 'trash' )
</span><span class="lines">@@ -2489,49 +2527,6 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Retrieve a single post, based on post ID.
- *
- * Has categories in 'post_category' property or key. Has tags in 'tags_input'
- * property or key.
- *
- * @since 1.0.0
- *
- * @param int $postid Post ID.
- * @param string $mode How to return result, either OBJECT, ARRAY_N, or ARRAY_A.
- * @return WP_Post|array WP_Post object or array holding post contents and information
- */
-function wp_get_single_post($postid = 0, $mode = OBJECT) {
-        $postid = (int) $postid;
-
-        $post = get_post($postid, $mode);
-
-        if (
-                ( OBJECT == $mode && empty( $post->ID ) ) ||
-                ( OBJECT != $mode && empty( $post['ID'] ) )
-        )
-                return ( OBJECT == $mode ? null : array() );
-
-        // Set categories and tags
-        if ( $mode == OBJECT ) {
-                $post->post_category = array();
-                if ( is_object_in_taxonomy($post->post_type, 'category') )
-                        $post->post_category = wp_get_post_categories($postid);
-                $post->tags_input = array();
-                if ( is_object_in_taxonomy($post->post_type, 'post_tag') )
-                        $post->tags_input = wp_get_post_tags($postid, array('fields' => 'names'));
-        } else {
-                $post['post_category'] = array();
-                if ( is_object_in_taxonomy($post['post_type'], 'category') )
-                        $post['post_category'] = wp_get_post_categories($postid);
-                $post['tags_input'] = array();
-                if ( is_object_in_taxonomy($post['post_type'], 'post_tag') )
-                        $post['tags_input'] = wp_get_post_tags($postid, array('fields' => 'names'));
-        }
-
-        return $post;
-}
-
-/**
</del><span class="cx"> * Insert a post.
</span><span class="cx"> *
</span><span class="cx"> * If the $postarr parameter has 'ID' set to a value, then post will be updated.
</span><span class="lines">@@ -2832,7 +2827,7 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         // First, get all of the original fields
</span><del>-        $post = wp_get_single_post($postarr['ID'], ARRAY_A);
</del><ins>+        $post = get_post($postarr['ID'], ARRAY_A);
</ins><span class="cx">
</span><span class="cx">         // Escape data pulled from DB.
</span><span class="cx">         $post = add_magic_quotes($post);
</span><span class="lines">@@ -3241,7 +3236,7 @@
</span><span class="cx"> function trackback_url_list($tb_list, $post_id) {
</span><span class="cx">         if ( ! empty( $tb_list ) ) {
</span><span class="cx">                 // get post data
</span><del>-                $postdata = wp_get_single_post($post_id, ARRAY_A);
</del><ins>+                $postdata = get_post($post_id, ARRAY_A);
</ins><span class="cx">
</span><span class="cx">                 // import postdata as variables
</span><span class="cx">                 extract($postdata, EXTR_SKIP);
</span></span></pre>
</div>
</div>
</body>
</html>