sanitize_post [ WordPress Function ]
sanitize_post ( $post, $context = 'display' )
| Parameters: |
|
| Uses: | |
| Returns: |
|
| Defined at: |
|
Soorgelijke functies: sanitize_post_field, sanitize_option, sanitize_user, sanitize_term, sanitize_meta
Sanitize every post field.
If the context is 'raw', then the post object or array will get minimal santization of the int fields.
Source
<?php
function sanitize_post($post, $context = 'display') {
if ( is_object($post) ) {
// Check if post already filtered for this context
if ( isset($post->filter) && $context == $post->filter )
return $post;
if ( !isset($post->ID) )
$post->ID = 0;
foreach ( array_keys(get_object_vars($post)) as $field )
$post->$field = sanitize_post_field($field, $post->$field, $post->ID, $context);
$post->filter = $context;
} else {
// Check if post already filtered for this context
if ( isset($post['filter']) && $context == $post['filter'] )
return $post;
if ( !isset($post['ID']) )
$post['ID'] = 0;
foreach ( array_keys($post) as $field )
$post[$field] = sanitize_post_field($field, $post[$field], $post['ID'], $context);
$post['filter'] = $context;
}
return $post;
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- WordPress › Support » bypass sanitize_post from wp_insert_post!
Is there a way around the commit at http://core.trac.wordpress.org/changeset/ 18367 which prevents us from using filter => true when programatically inserting ...
wordpress.org - #5325 (sanitize_post and sanitize_post_field are very expensive no ...
Simple, commonly-called template functions (the_title, get_permalink, etc.) are all channeled through the get_post function. While get_post implements caching, ...
core.trac.wordpress.org - PHPXRef 0.7 : WordPress : Function Reference: sanitize_post()
sanitize_post(). Defined at: /wp-includes/post.php -> line 1663. Referenced 9 times: /wp-includes/query.php -> line 2763 · /wp-includes/post.php -> line 391 ...
phpxref.ftwr.co.uk - sanitize_post (WordPress Function) - WPSeek.com
WordPress lookup for sanitize_post, a WordPress Function. wpseek.com is a WordPress-centric search tool for developers and theme authors.
wpseek.com