Authors mapping and caching bug
-
Hi,
Great job on the plugin.
I found a very specific bug relating to object cache plugins. The following line that saves the authors from the user submitted mapping to save_authors():292 does not properly clear the object cache related to each post.
$wpdb->query($wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE id IN ($post_ids)", $user_id));
Sites with caching plugins, such as W3 Total Cache or Memcached Object Cache, users will see no change. They will continue to see the user that imported the posts as the author until the cache is cleared (for each post or the entire site). To fix this, I propose that we use:
foreach( $post_ids as $p ) { wp_update_post( array( 'ID' => $p, 'post_author' => $user_id, ) ); }
This should clear the proper caches. Thanks.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Authors mapping and caching bug’ is closed to new replies.