W3C RSS error after copying posts from one blog to another
The W3C error is showing the date format is wrong and the guid is missing.
The first error can be solved adding these fields when creating the post:
post_date_gmt
and post_modified_gmt
On the other hand, the recommendation about the guid
can be met adding this field:
guid
Like this:
public function SavePostTarget( $PostTitle, $PostContent, $AuthorID, $PostSlug, $PostType ) { $PostDate = new DateTime( date( 'Y-m-d H:i:s' ) ); $PostTitle = str_replace( "'", '"', $PostTitle ); $GMTDate = gmdate( 'Y-m-d H:i:s' ); // ADDED - GMT Date Time should be included to avoid RSS errors $TargetHost = 'TargetDomain.com'; // ADDED $PostGuid = "$TargetHost/$PostSlug"; // ADDED - Guid should be included to avoid RSS errors $SavePostQuery = "INSERT INTO wp_posts ( post_title, post_content, post_author, post_name, post_type, post_date, post_modified, post_status, post_date_gmt, post_modified_gmt, guid ) VALUES ( '" . $PostTitle . "', '" . $PostContent . "', '" . $AuthorID . "', '" . $PostSlug . "', '" . $PostType . "', '" . $PostDate->format( 'Y-m-d H:i:s' ) . "', '" . $PostDate->format( 'Y-m-d H:i:s' ) . "', 'publish', '" . $GMTDate . "', '" . $GMTDate . "', '" . $PostGuid . "' )"; ...