TRANSIENT ); $this->indexing_helper->set_reason( Indexing_Reasons::REASON_TAXONOMY_MADE_PUBLIC ); $this->maybe_add_notification(); } // There are taxonomies that have been made private. if ( ! empty( $newly_made_non_public_taxonomies ) ) { // Schedule a cron job to remove all the terms whose taxonomy has been made private. $cleanup_not_yet_scheduled = ! \wp_next_scheduled( Cleanup_Integration::START_HOOK ); if ( $cleanup_not_yet_scheduled ) { \wp_schedule_single_event( ( \time() + ( \MINUTE_IN_SECONDS * 5 ) ), Cleanup_Integration::START_HOOK ); } } } /** * Decides if a notification should be added in the notification center. * * @return void */ private function maybe_add_notification() { $notification = $this->notification_center->get_notification_by_id( 'taxonomies-made-public' ); if ( \is_null( $notification ) ) { $this->add_notification(); } } /** * Adds a notification to be shown on the next page request since posts are updated in an ajax request. * * @return void */ private function add_notification() { $message = \sprintf( /* translators: 1: Opening tag of the link to the Search appearance settings page, 2: Link closing tag. */ \esc_html__( 'It looks like you\'ve added a new taxonomy to your website. We recommend that you review your %1$sSearch appearance settings%2$s.', 'wordpress-seo' ), '', '' ); $notification = new Yoast_Notification( $message, [ 'type' => Yoast_Notification::WARNING, 'id' => 'taxonomies-made-public', 'capabilities' => 'wpseo_manage_options', 'priority' => 0.8, ] ); $this->notification_center->add_notification( $notification ); } }