postmeta_form_keys

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

Description

apply_filters( 'postmeta_form_keys', (null) $null, (WP_Post) $post ); 

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

Parameters (2)

0. $null (null) => null
Pre-defined meta keys to be used in place of a postmeta query. Default null.
1. $post (WP_Post)
The current post object.

Usage

To run the hook, copy the example below.
  1. $null = apply_filters( 'postmeta_form_keys', $null, $post ); 
  2.  
  3. if ( !empty( $null ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the postmeta_form_keys callback 
  2. function filter_postmeta_form_keys( $null, $post ) { 
  3. // make filter magic happen here... 
  4. return $null
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'postmeta_form_keys', 'filter_postmeta_form_keys', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'postmeta_form_keys', 'filter_postmeta_form_keys', 10, 2 ); 

Defined (1)

The filter is defined in the following location(s).

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