Filters the value of a specific post field for display.
Description
Only applied to post fields name which is <em>not</em> prefixed with post_. The dynamic portion of the hook name, $field, refers to the post field name. Possible filter names include: <ul> <li>post_ID</li> <li>post_comment_status</li> <li>post_ping_status</li> <li>post_to_ping</li> <li>post_pinged</li> <li>post_guid</li> <li>post_menu_order</li> <li>post_comment_count</li> </ul>
Parameters
$valuemixed
Value of the unprefixed post field.
$post_idint
Post ID
$contextstring
Context for how to sanitize the field. Accepts 'raw', 'edit', 'db', 'display', 'attribute', or 'js'. The 'sample' value is used for permalink previewing. Default 'display'.
3316* @param int$post_id Post ID3317* @param string$context Context for how to sanitize the field.3318* Accepts 'raw','edit','db','display',3319*'attribute',or'js'. The 'sample' value is3320* used for permalink previewing.Default'display'.3321*/3322$value=apply_filters("post_{$field}",$value,$post_id,$context);3323}33243325if('attribute'===$context){3326$value=esc_attr($value);3327}elseif('js'===$context){3328$value=esc_js($value);
History
Introduced in 2.3.0. Unchanged from 6.7.7 through 7.1.0.