| @@ -288,8 +288,32 @@ | ||
| 288 | 288 | |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | /** |
| 292 | + * Returns all Post Meta rows stored against this Post for the Plugin's Post Meta key. | |
| 293 | + * | |
| 294 | + * Queries the database directly, as each row's meta ID is required to delete individual | |
| 295 | + * duplicate rows, which get_post_meta() doesn't return. | |
| 296 | + * | |
| 297 | + * @since 3.4.5 | |
| 298 | + * | |
| 299 | + * @return array Post Meta rows, oldest first. | |
| 300 | + */ | |
| 301 | + public function get_meta_rows() { | |
| 302 | + | |
| 303 | + global $wpdb; | |
| 304 | + | |
| 305 | + return $wpdb->get_results( | |
| 306 | + $wpdb->prepare( | |
| 307 | + "SELECT meta_id, meta_value FROM {$wpdb->postmeta} WHERE post_id = %d AND meta_key = %s ORDER BY meta_id ASC", | |
| 308 | + $this->post_id, | |
| 309 | + self::POST_META_KEY | |
| 310 | + ) | |
| 311 | + ); | |
| 312 | + | |
| 313 | + } | |
| 314 | + | |
| 315 | + /** | |
| 292 | 316 | * Saves Post settings to the Post. |
| 293 | 317 | * |
| 294 | 318 | * @since 1.9.6 |
| 295 | 319 | * |