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