@@ 70-84 (lines=15) @@ | ||
67 | * @param string $context Optional. The context of how the field will be used. |
|
68 | * @return string|WP_Error |
|
69 | */ |
|
70 | function get_bookmark_field( $field, $bookmark, $context = 'display' ) { |
|
71 | $bookmark = (int) $bookmark; |
|
72 | $bookmark = get_bookmark( $bookmark ); |
|
73 | ||
74 | if ( is_wp_error($bookmark) ) |
|
75 | return $bookmark; |
|
76 | ||
77 | if ( !is_object($bookmark) ) |
|
78 | return ''; |
|
79 | ||
80 | if ( !isset($bookmark->$field) ) |
|
81 | return ''; |
|
82 | ||
83 | return sanitize_bookmark_field($field, $bookmark->$field, $bookmark->link_id, $context); |
|
84 | } |
|
85 | ||
86 | /** |
|
87 | * Retrieves the list of bookmarks |
@@ 1032-1044 (lines=13) @@ | ||
1029 | * @param string $context Optional, default is display. Look at sanitize_term_field() for available options. |
|
1030 | * @return string|int|null|WP_Error Will return an empty string if $term is not an object or if $field is not set in $term. |
|
1031 | */ |
|
1032 | function get_term_field( $field, $term, $taxonomy = '', $context = 'display' ) { |
|
1033 | $term = get_term( $term, $taxonomy ); |
|
1034 | if ( is_wp_error($term) ) |
|
1035 | return $term; |
|
1036 | ||
1037 | if ( !is_object($term) ) |
|
1038 | return ''; |
|
1039 | ||
1040 | if ( !isset($term->$field) ) |
|
1041 | return ''; |
|
1042 | ||
1043 | return sanitize_term_field( $field, $term->$field, $term->term_id, $term->taxonomy, $context ); |
|
1044 | } |
|
1045 | ||
1046 | /** |
|
1047 | * Sanitizes Term for editing. |