| @@ -72,8 +72,20 @@ | ||
| 72 | 72 | $meta[ $key ] = $value; |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | + /** | |
| 77 | + * Programmatically define ConvertKit settings for an individual Post, overriding those defined in the | |
| 78 | + * meta box. | |
| 79 | + * | |
| 80 | + * @since 2.4.4 | |
| 81 | + * | |
| 82 | + * @param array $meta Post Settings. | |
| 83 | + * @param int $post_id Post ID. | |
| 84 | + * @return array Post Settings. | |
| 85 | + */ | |
| 86 | + $meta = apply_filters( 'convertkit_post_settings', $meta, $this->post_id ); | |
| 87 | + | |
| 76 | 88 | // Assign Post's Settings to the object. |
| 77 | 89 | $this->settings = $meta; |
| 78 | 90 | |
| 79 | 91 | } |
| @@ -301,11 +313,11 @@ | ||
| 301 | 313 | public function get_default_settings() { |
| 302 | 314 | |
| 303 | 315 | $defaults = array( |
| 304 | 316 | 'form' => '-1', // -1: Plugin Default Form, 0: No Form, 1+: Specific Form ID on ConvertKit. |
| 305 | - 'landing_page' => '', | |
| 306 | - 'tag' => '', | |
| 307 | - 'restrict_content' => '', | |
| 317 | + 'landing_page' => '0', // 0: None, 1+: Specific Landing Page ID. | |
| 318 | + 'tag' => '0', // 0: None, 1+: Specific Tag ID. | |
| 319 | + 'restrict_content' => '0', // 0: None, form_<id> / tag_<id> / product_<id>: restrict to that resource. | |
| 308 | 320 | ); |
| 309 | 321 | |
| 310 | 322 | /** |
| 311 | 323 | * The default settings, used to populate the Post's Settings when a Post has no Settings. |
| @@ -312,10 +324,11 @@ | ||
| 312 | 324 | * |
| 313 | 325 | * @since 1.9.6 |
| 314 | 326 | * |
| 315 | 327 | * @param array $defaults Default Settings. |
| 328 | + * @param int $post_id Post ID. | |
| 316 | 329 | */ |
| 317 | - $defaults = apply_filters( 'convertkit_post_get_default_settings', $defaults ); | |
| 330 | + $defaults = apply_filters( 'convertkit_post_get_default_settings', $defaults, $this->post_id ); | |
| 318 | 331 | |
| 319 | 332 | return $defaults; |
| 320 | 333 | |
| 321 | 334 | } |