February 12, 2011 2:35 am
Definition:
function sanitize_post_field($field, $value, $post_id, $context) {}
returns:Sanitized value.
apply_filters("edit_{$field}", $value, $post_id)apply_filters("{$field_no_prefix}_edit_pre", $value, $post_id)function sanitize_post_field($field, $value, $post_id, $context) {
$int_fields = array('ID', 'post_parent', 'menu_order');
if ( in_array($field, $int_fields) )
$value = (int) $value;
// Fields which contain arrays of ints.
$array_int_fields = array( 'ancestors' );
if ( in_array($field, $array_int_fields) ) {
$value = array_map( 'absint', $value);
return $value;
}
if ( 'raw' == $context )
return $value;
$prefixed = false;
if ( false !== strpos($field, 'post_') ) {
$prefixed = true;
$field_no_prefix = str_replace('post_', '', $field);
}
if ( 'edit' == $context ) {
$format_to_edit = array('post_content', 'post_excerpt', 'post_title', 'post_password');
if ( $prefixed ) {
$value = apply_filters("edit_{$field}", $value, $post_id);
// Old school
$value = apply_filters("{$field_no_prefix}_edit_pre", $value, $post_id);
} else {
2781
Posted by Thorsten
Categories: /wp-includes/post.php, Documentation, Files, Filters, Filters by letter e, Functions, Functions by letter s, {
Tags: ${field_no_prefix}_edit_pre, edit_$field, id5e20ca0d5cf937795e86ca9fdb0e68ef, sanitize_post_field
Mobile Site | Full Site
Get a free blog at WordPress.com Theme: WordPress Mobile Edition by Alex King.