update_recently_edited

函数
update_recently_edited ( $file )
参数
  • (string) $file
    Required:
定义位置
相关方法
update_comment_metaupdate_comment_cacheupdate_metadata_by_midupdate_menu_item_cacheupdate_archived
引入
1.5.0
弃用
-

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 );
}

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2026-01-29 07:09:33

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: