after-kubio-activation.php
4 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
1 month 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
3 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
2 months ago
kubio-fresh-site.php
41 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | function _kubio_set_fresh_site() { |
| 5 | update_option( 'kubio_is_fresh_site', 1 ); |
| 6 | } |
| 7 | |
| 8 | function kubio_is_fresh_site() { |
| 9 | return ! ! intval( get_option( 'kubio_is_fresh_site', 0 ) ); |
| 10 | } |
| 11 | |
| 12 | |
| 13 | function _kubio_remove_fresh_install_flag() { |
| 14 | update_option( 'kubio_is_fresh_site', 0 ); |
| 15 | } |
| 16 | |
| 17 | function kubio_add_fresh_site_removal_hooks() { |
| 18 | |
| 19 | // do not automatically change the fresh_site flag while in cli |
| 20 | if ( defined( 'WP_CLI' ) ) { |
| 21 | return; |
| 22 | } |
| 23 | |
| 24 | foreach ( |
| 25 | array( |
| 26 | 'publish_post', |
| 27 | 'publish_page', |
| 28 | 'wp_ajax_save-widget', |
| 29 | 'wp_ajax_widgets-order', |
| 30 | 'customize_save_after', |
| 31 | 'rest_after_save_widget', |
| 32 | 'rest_delete_widget', |
| 33 | 'rest_save_sidebar', |
| 34 | ) as $action |
| 35 | ) { |
| 36 | add_action( $action, '_kubio_remove_fresh_install_flag', 0 ); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | kubio_add_fresh_site_removal_hooks(); |
| 41 |