register_post_type(); ( new Taxonomies() )->register_taxonomies(); update_option( 'kdocs_flush_rewrite', 1 ); Migrations\Migrator::run(); if ( ! get_option( 'kdocs_installed_at' ) ) { update_option( 'kdocs_installed_at', time() ); if ( $redirect ) { set_transient( 'kdocs_activation_redirect', 1, 60 ); } } } /** * Deactivation callback. */ public static function deactivate() { flush_rewrite_rules( false ); } /** * Runs pending migrations (admin requests and WP-CLI). Also records the plugin * version so upgrade notices can compare against it. */ public function maybe_upgrade() { Migrations\Migrator::run(); if ( KDOCS_VERSION !== get_option( 'kdocs_version' ) ) { update_option( 'kdocs_version', KDOCS_VERSION ); } } /** * Sends the user to the dashboard after first activation. */ public function activation_redirect() { if ( ! get_transient( 'kdocs_activation_redirect' ) ) { return; } delete_transient( 'kdocs_activation_redirect' ); if ( wp_doing_ajax() || is_network_admin() || isset( $_GET['activate-multi'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification return; } wp_safe_redirect( Admin\Admin::url( get_option( 'kdocs_setup_done' ) ? 'dashboard' : 'setup' ) ); exit; } /** * Creates the sample knowledge base (onboarding screen and Tools). * * @param string $set Demo content set (see Demo\Importer::sets()). * @return int|\WP_Error Knowledge base id. */ public static function create_sample_content( $set = 'guide' ) { return Demo\Importer::import( $set ); } }