IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
499 | 499 | * @see sanitize_post_field() |
500 | 500 | * |
501 | 501 | * @param string $field Post field name. |
502 | | * @param int|WP_Post $post Post ID or post object. |
| 502 | * @param int|WP_Post $post Optional. Post ID or post object. Default: null |
503 | 503 | * @param string $context Optional. How to filter the field. Accepts 'raw', 'edit', 'db', |
504 | 504 | * or 'display'. Default 'display'. |
| 505 | * @param mixed $default Optional. Default value. |
505 | 506 | * @return string The value of the post field on success, empty string on failure. |
506 | 507 | */ |
507 | | function get_post_field( $field, $post, $context = 'display' ) { |
| 508 | function get_post_field( $field, $post = null, $context = 'display', $default = '' ) { |
508 | 509 | $post = get_post( $post ); |
509 | 510 | |
510 | | if ( !$post ) |
511 | | return ''; |
512 | | |
513 | | if ( !isset($post->$field) ) |
514 | | return ''; |
| 511 | if ( !$post || !isset($post->$field) ) |
| 512 | return $default; |
515 | 513 | |
516 | 514 | return sanitize_post_field($field, $post->$field, $post->ID, $context); |
517 | 515 | } |