postmeta_form_keys filter-hookWP 4.4.0

Filters values for the meta key dropdown in the Custom Fields meta box.

Returning a non-null value will effectively short-circuit and avoid a potentially expensive query against postmeta.

Usage

add_filter( 'postmeta_form_keys', 'wp_kama_postmeta_form_keys_filter', 10, 2 );

/**
 * Function for `postmeta_form_keys` filter-hook.
 * 
 * @param array|null $keys Pre-defined meta keys to be used in place of a postmeta query.
 * @param WP_Post    $post The current post object.
 *
 * @return array|null
 */
function wp_kama_postmeta_form_keys_filter( $keys, $post ){

	// filter...
	return $keys;
}
$keys(array|null)
Pre-defined meta keys to be used in place of a postmeta query.
Default: null
$post(WP_Post)
The current post object.

Changelog

Since 4.4.0 Introduced.

Where the hook is called

meta_form()
postmeta_form_keys
wp-admin/includes/template.php 686
$keys = apply_filters( 'postmeta_form_keys', null, $post );

Where the hook is used in WordPress

Usage not found.