|
@@ 1235-1248 (lines=14) @@
|
| 1232 |
|
* @param string $old_status The old post status |
| 1233 |
|
* @param object $post Post object |
| 1234 |
|
*/ |
| 1235 |
|
function _update_blog_date_on_post_publish( $new_status, $old_status, $post ) { |
| 1236 |
|
$post_type_obj = get_post_type_object( $post->post_type ); |
| 1237 |
|
if ( ! $post_type_obj || ! $post_type_obj->public ) { |
| 1238 |
|
return; |
| 1239 |
|
} |
| 1240 |
|
|
| 1241 |
|
if ( 'publish' != $new_status && 'publish' != $old_status ) { |
| 1242 |
|
return; |
| 1243 |
|
} |
| 1244 |
|
|
| 1245 |
|
// Post was freshly published, published post was saved, or published post was unpublished. |
| 1246 |
|
|
| 1247 |
|
wpmu_update_blogs_date(); |
| 1248 |
|
} |
| 1249 |
|
|
| 1250 |
|
/** |
| 1251 |
|
* Handler for updating the blog date when a published post is deleted. |
|
@@ 1257-1270 (lines=14) @@
|
| 1254 |
|
* |
| 1255 |
|
* @param int $post_id Post ID |
| 1256 |
|
*/ |
| 1257 |
|
function _update_blog_date_on_post_delete( $post_id ) { |
| 1258 |
|
$post = get_post( $post_id ); |
| 1259 |
|
|
| 1260 |
|
$post_type_obj = get_post_type_object( $post->post_type ); |
| 1261 |
|
if ( ! $post_type_obj || ! $post_type_obj->public ) { |
| 1262 |
|
return; |
| 1263 |
|
} |
| 1264 |
|
|
| 1265 |
|
if ( 'publish' != $post->post_status ) { |
| 1266 |
|
return; |
| 1267 |
|
} |
| 1268 |
|
|
| 1269 |
|
wpmu_update_blogs_date(); |
| 1270 |
|
} |
| 1271 |
|
|
| 1272 |
|
/** |
| 1273 |
|
* Handler for updating the blog posts count date when a post is deleted. |