| @@ -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 | * |
| @@ -313,11 +337,11 @@ | ||
| 313 | 337 | public function get_default_settings() { |
| 314 | 338 | |
| 315 | 339 | $defaults = array( |
| 316 | 340 | 'form' => '-1', // -1: Plugin Default Form, 0: No Form, 1+: Specific Form ID on ConvertKit. |
| 317 | - 'landing_page' => '', | |
| 318 | - 'tag' => '', | |
| 319 | - 'restrict_content' => '', | |
| 341 | + 'landing_page' => '0', // 0: None, 1+: Specific Landing Page ID. | |
| 342 | + 'tag' => '0', // 0: None, 1+: Specific Tag ID. | |
| 343 | + 'restrict_content' => '0', // 0: None, form_<id> / tag_<id> / product_<id>: restrict to that resource. | |
| 320 | 344 | ); |
| 321 | 345 | |
| 322 | 346 | /** |
| 323 | 347 | * The default settings, used to populate the Post's Settings when a Post has no Settings. |