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) =>
"
- \n" $value
- 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.
- $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 );
- if ( !empty( $li_span_class_post_meta_key_key_span_value_li_n ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the the_meta_key callback
- function filter_the_meta_key( $li_span_class_post_meta_key_key_span_value_li_n, $key, $value ) {
- // make filter magic happen here...
- return $li_span_class_post_meta_key_key_span_value_li_n;
- };
- // add the filter
- add_filter( 'the_meta_key', 'filter_the_meta_key', 10, 3 );
- To remove a hook callback, use the example below.
- // remove the filter
- 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
- echo apply_filters( 'the_meta_key', "<li><span class='post-meta-key'>$key:</span> $value</li>\n", $key, $value );