| 1149 | * Get default value for meta |
| 1150 | * |
| 1151 | * @param $object_type |
| 1152 | * @param $meta_key |
| 1153 | * @param string $object_subtype |
| 1154 | * |
| 1155 | * @return mixed|void |
| 1156 | */ |
| 1157 | function get_metadata_default( $object_type, $meta_key, $object_subtype = '' ) { |
| 1158 | global $wp_meta_keys; |
| 1159 | |
| 1160 | if ( ! is_array( $wp_meta_keys ) ) { |
| 1161 | $wp_meta_keys = array(); |
| 1162 | } |
| 1163 | |
| 1164 | $default_value = ''; |
| 1165 | |
| 1166 | if ( isset( $wp_meta_keys[ $object_type ][ $object_subtype ][ $meta_key ]['default_value'] ) && |
| 1167 | false !== $wp_meta_keys[ $object_type ][ $object_subtype ][ $meta_key ]['default_value'] ) { |
| 1168 | $default_value = $wp_meta_keys[ $object_type ][ $object_subtype ][ $meta_key ]['default_value']; |
| 1169 | } |
| 1170 | |
| 1171 | /** |
| 1172 | * |
| 1173 | * @since 5.0.0 |
| 1174 | * |
| 1175 | * @param null|array|string $default_value The default value of get_metadata() should return - a single metadata value, |
| 1176 | * or an array of values. |
| 1177 | * @param $meta_key |
| 1178 | * @param $object_type |
| 1179 | * @param string $object_subtype. |
| 1180 | */ |
| 1181 | $default_value = apply_filters( "default_{$object_type}_meta_{$meta_key}", $default_value, $meta_key, $object_type, $object_subtype ); |
| 1182 | |
| 1183 | if ( ! empty( $object_subtype ) ) { |
| 1184 | /** |
| 1185 | * |
| 1186 | * @since 5.0.0 |
| 1187 | * |
| 1188 | * @param null|array|string $default_value The default value of get_metadata() should return - a single metadata value, |
| 1189 | * or an array of values. |
| 1190 | * @param $meta_key |
| 1191 | * @param $object_type |
| 1192 | * @param string $object_subtype. |
| 1193 | */ |
| 1194 | $default_value = apply_filters( "default_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $default_value, $meta_key, $object_type, $object_subtype ); |
| 1195 | } |
| 1196 | |
| 1197 | |
| 1198 | return $default_value; |
| 1199 | } |
| 1200 | |
| 1201 | /** |