after-kubio-activation.php
3 months ago
allow-kubio-blog-override.php
2 years ago
cache-plugins.php
4 years ago
default-editor-overlay.php
1 year ago
dismissable-notice.php
5 days ago
gutenerg-plugin-check.php
1 year ago
image-size-auto-fix.php
1 year ago
kubio-fresh-site.php
2 years ago
post-insert.php
2 months ago
register-meta-fields.php
3 years ago
requirements-notices.php
1 year ago
site-urls.php
1 year ago
starter-sites-feature.php
1 year ago
svg-kses.php
1 year ago
wp-import.php
1 month ago
register-meta-fields.php
28 lines
| 1 | <?php |
| 2 | |
| 3 | use Kubio\Core\Utils; |
| 4 | |
| 5 | register_meta( |
| 6 | 'post', |
| 7 | 'saved_in_kubio', |
| 8 | array( |
| 9 | 'object_subtype' => '', |
| 10 | 'type' => 'boolean', |
| 11 | 'single' => true, |
| 12 | 'default' => false, |
| 13 | 'sanitize_callback' => 'rest_sanitize_boolean', |
| 14 | 'show_in_rest' => true, |
| 15 | ) |
| 16 | ); |
| 17 | |
| 18 | |
| 19 | function kubio_set_post_as_saved_in_kubio( $post_id ) { |
| 20 | if ( Utils::hasKubioEditorReferer() ) { |
| 21 | $previous_value = get_post_meta( $post_id, 'saved_in_kubio', true ); |
| 22 | update_post_meta( $post_id, 'saved_in_kubio', true, $previous_value ); |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | |
| 27 | add_action( 'wp_after_insert_post', 'kubio_set_post_as_saved_in_kubio', 10, 1 ); |
| 28 |