Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using CMS Press for custom post types. The issue is the feed doesn't validate because lastBuildDate is blank. I am not using WordPress's default posts for anything and that is causing the problem.

I did a test post using WordPress's default post and voila lastBuildDate was filled in and the feed validated.

As soon as I deleted the post it removed the date in lastBuildDate and the feed didn't validate.

I'm using the code below to add the custom post types in the main feed but this is an issue with the feeds created by the custom post types also.

Am I missing something to get the lastBuildDate to populate?

if ( ( is_front_page() && false == $query->query_vars['suppress_filters'] ) || is_feed() ){
        $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
        query_posts( array('post_type'=>array('post', 'games', 'entertainment', 'tech', 'podcasts'),'paged'=>$paged ) );
} 

I answered my own question below.

share|improve this question
    
Glad it worked for you. :) I want to note that solutions should be posted as answers, not added to question. Even if it's your solution to your own question. –  Rarst Feb 1 '11 at 21:15

2 Answers 2

up vote 1 down vote accepted

This is the solution I found based off of @Rarst's answer. Put this in the themes functions.php and it worked like a charm!

add_filter('get_lastpostmodified', 'my_lastpostmodified');
function my_lastpostmodified()
{
    global $wpdb;
    $add_seconds_server = date('Z');
    return $wpdb->get_var("SELECT  DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' ORDER  BY post_modified_gmt DESC LIMIT 1");
} 
share|improve this answer

lastBuildDate is getting filled with data returned by get_lastpostmodified() function. Which only checks for native post type, so if you have none - there is no date found.

Filter get_lastpostmodified hook to return some other build date (in MySQL DATETIME format) instead of it.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.