the_meta_key

Filters the HTML output of the li element in the post custom fields list.

Description

apply_filters( 'the_meta_key', (string) $li_span_class_post_meta_key_key_span_value_li_n, (string) $key, (string) $value ); 

Parameters (3)

0. $li_span_class_post_meta_key_key_span_value_li_n — Optional. (string) => "
  • $value
  • \n"
    The li span class post meta key key span value li n.
    1. $key (string)
    Meta key.
    2. $value (string)
    Meta value.

    Usage

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

    Defined (1)

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

    /wp-includes/post-template.php  
    1. echo apply_filters( 'the_meta_key', "<li><span class='post-meta-key'>$key:</span> $value</li>\n", $key, $value );