Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Change FeedWordPress behavior to reset post_date_gmt to now
* For the FeedWordPress posts that are published on import, set the
* publication timestamp to now (instead of the datetime in the feed)
add_filter( 'syndicated_item_published', 'fwpx_syndicated_item_published' );
function fwpx_syndicated_item_published( $ts ) {
return time();
* Reset FeedWordPress' behavior of setting the post_date_gmt
* Only do this where the guid is different than our existing site and for 'pending' posts
* We want editors to be able to "Publish Immediately", instead of publish at the syndicated post's publication time.
add_filter( 'update_syndicated_feed_completed', 'fwpx_update_syndicated_feed_completed' );
function fwpx_update_syndicated_feed_completed( $import_id ) {
global $wpdb;
// Get all of the syndicated posts that haven't yet been published
$query = $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_status='pending' AND guid NOT LIKE %s;", '%' . site_url() . '%' );
$post_ids = $wpdb->get_col( $query );
foreach( $post_ids as $post_id ) {
$wpdb->update( $wpdb->posts, array( 'post_date_gmt' => '0000-00-00 00:00:00' ), array( 'ID' => $post_id ) );

Thanks Daniel. I've added this to feedwordpress/posts-page.php (probably very brutal/inelegant act, but) it works for new posts! However, when the posts are syndicated, they turned to "scheduled" again.

Trialing & erring. Appreciate if you may help.

Does you fixed this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment