
如何使用Varying Vagrant Vagrants (VVV) 进行WordPress开发
update_recently_edited ( $file )
update_recently_edited: 这个函数更新最近编辑过的文章缓存。它需要一个参数:$post_id。$post_id是最近编辑过的文章的ID。
更新插件或主题文件编辑器的”recently-edited”的文件。
function update_recently_edited( $file ) { $oldfiles = (array) get_option( 'recently_edited' ); if ( $oldfiles ) { $oldfiles = array_reverse( $oldfiles ); $oldfiles[] = $file; $oldfiles = array_reverse( $oldfiles ); $oldfiles = array_unique( $oldfiles ); if ( 5 < count( $oldfiles ) ) { array_pop( $oldfiles ); } } else { $oldfiles[] = $file; } update_option( 'recently_edited', $oldfiles ); }