wp_post_revision_meta_keys

函数
wp_post_revision_meta_keys ( $post_type )
参数
  • (string) $post_type The post type being revisioned.
    Required:
返回值
  • (array) An array of meta keys to be revisioned.
定义位置
相关方法
_wp_post_revision_datawp_post_revision_titlepost_revisions_meta_boxwp_restore_post_revision_meta_wp_post_revision_fields
引入
6.4.0
弃用
-

确定应修改哪些后元字段。

function wp_post_revision_meta_keys( $post_type ) {
	$registered_meta = array_merge(
		get_registered_meta_keys( 'post' ),
		get_registered_meta_keys( 'post', $post_type )
	);

	$wp_revisioned_meta_keys = array();

	foreach ( $registered_meta as $name => $args ) {
		if ( $args['revisions_enabled'] ) {
			$wp_revisioned_meta_keys[ $name ] = true;
		}
	}

	$wp_revisioned_meta_keys = array_keys( $wp_revisioned_meta_keys );

	/**
	 * Filter the list of post meta keys to be revisioned.
	 *
	 * @since 6.4.0
	 *
	 * @param array  $keys      An array of meta fields to be revisioned.
	 * @param string $post_type The post type being revisioned.
	 */
	return apply_filters( 'wp_post_revision_meta_keys', $wp_revisioned_meta_keys, $post_type );
}

常见问题

FAQs
查看更多 >