sts_with_default_title = \count( $posts_with_default_seo_title ) > 4; $has_enough_posts_with_default_desc = \count( $posts_with_default_seo_description ) > 4; if ( ! $has_enough_posts_with_default_title && ! $has_enough_posts_with_default_desc ) { $this->notification_center->remove_notification_by_id( self::NOTIFICATION_ID ); return; } $notification = $this->get_default_seo_data_notification( $has_enough_posts_with_default_title, $has_enough_posts_with_default_desc ); $this->notification_center->add_notification( $notification ); } /** * Build the default SEO data notification. * * @param bool $has_enough_posts_with_default_title Whether there are content types with default SEO title in their most recent posts. * @param bool $has_enough_posts_with_default_desc Whether there are content types with default SEO description in their most recent posts. * * @return Yoast_Notification The notification containing the suggested plugin. */ private function get_default_seo_data_notification( $has_enough_posts_with_default_title, $has_enough_posts_with_default_desc ): Yoast_Notification { $message = $this->get_default_seo_data_message( $has_enough_posts_with_default_title, $has_enough_posts_with_default_desc ); return new Yoast_Notification( $message, [ 'id' => self::NOTIFICATION_ID, 'type' => Yoast_Notification::WARNING, 'capabilities' => [ 'wpseo_manage_options' ], ] ); } /** * Creates a message to inform users that they are using only default SEO data lately. * * @param bool $has_enough_posts_with_default_title Whether there are content types with default SEO title in their most recent posts. * @param bool $has_enough_posts_with_default_desc Whether there are content types with default SEO description in their most recent posts. * * @return string The default SEO data message. */ private function get_default_seo_data_message( $has_enough_posts_with_default_title, $has_enough_posts_with_default_desc ): string { $shortlink = ( $this->product_helper->is_premium() ) ? $this->short_link_helper->get( 'https://yoa.st/ai-generate-alert-premium/' ) : $this->short_link_helper->get( 'https://yoa.st/ai-generate-alert-free/' ); if ( $has_enough_posts_with_default_title && $has_enough_posts_with_default_desc ) { $default_seo_data = \esc_html__( 'SEO titles and meta descriptions', 'wordpress-seo' ); } elseif ( $has_enough_posts_with_default_title ) { $default_seo_data = \esc_html__( 'SEO titles', 'wordpress-seo' ); } elseif ( $has_enough_posts_with_default_desc ) { $default_seo_data = \esc_html__( 'meta descriptions', 'wordpress-seo' ); } else { $default_seo_data = \esc_html__( 'SEO data', 'wordpress-seo' ); } /* translators: %1$s expands to "SEO title" or "meta description", %2$s expands to an opening link tag, %3$s expands to an opening strong tag, %4$s expands to a closing strong tag, %5$s expands to a closing link tag. */ $message = ( $this->product_helper->is_premium() ) ? \esc_html__( 'Your recent posts are using default %1$s, which can make them easy to overlook in search results. Update them manually or %2$sfind out how %3$sYoast AI Generate%4$s can improve them for you.%5$s', 'wordpress-seo' ) : \esc_html__( 'Your recent posts are using default %1$s, which can make them easy to overlook in search results. Update them for better visibility or %2$stry %3$sYoast AI Generate%4$s for free to do it faster.%5$s', 'wordpress-seo' ); return \sprintf( $message, $default_seo_data, '', '', '', '' ); } } e_id' ) ->where_in( 'target_indexable_id', $indexable_ids ) ->group_by( 'target_indexable_id' ) ->find_array(); // If the above query fails, do not update anything. if ( ! \is_array( $indexable_counts ) ) { return []; } // Get all ID's returned from the query and set them as keys for easy access. $returned_ids = \array_flip( \array_column( $indexable_counts, 'target_indexable_id' ) ); // Loop over the original ID's and search them in the returned ID's. If they don't exist, add them with an incoming count of 0. foreach ( $indexable_ids as $id ) { // Cast the ID to string, as the arrays only contain stringified versions of the ID. $id = \strval( $id ); if ( isset( $returned_ids[ $id ] ) === false ) { $indexable_counts[] = [ 'incoming' => '0', 'target_indexable_id' => $id, ]; } } return $indexable_counts; } /** * Deletes all seo links for the given ids. * * @param int[] $ids The seo link ids. * * @return bool Whether or not the delete was succesfull. */ public function delete_many_by_id( $ids ) { return $this->query() ->where_in( 'id', $ids ) ->delete_many(); } /** * Insert multiple seo links. * * @param SEO_Links[] $links The seo links to be inserted. * * @return bool Whether or not the insert was succesfull. */ public function insert_many( $links ) { return $this->query() ->insert_many( $links ); } } e_id' ) ->where_in( 'target_indexable_id', $indexable_ids ) ->group_by( 'target_indexable_id' ) ->find_array(); // If the above query fails, do not update anything. if ( ! \is_array( $indexable_counts ) ) { return []; } // Get all ID's returned from the query and set them as keys for easy access. $returned_ids = \array_flip( \array_column( $indexable_counts, 'target_indexable_id' ) ); // Loop over the original ID's and search them in the returned ID's. If they don't exist, add them with an incoming count of 0. foreach ( $indexable_ids as $id ) { // Cast the ID to string, as the arrays only contain stringified versions of the ID. $id = \strval( $id ); if ( isset( $returned_ids[ $id ] ) === false ) { $indexable_counts[] = [ 'incoming' => '0', 'target_indexable_id' => $id, ]; } } return $indexable_counts; } /** * Deletes all seo links for the given ids. * * @param int[] $ids The seo link ids. * * @return bool Whether or not the delete was succesfull. */ public function delete_many_by_id( $ids ) { return $this->query() ->where_in( 'id', $ids ) ->delete_many(); } /** * Insert multiple seo links. * * @param SEO_Links[] $links The seo links to be inserted. * * @return bool Whether or not the insert was succesfull. */ public function insert_many( $links ) { return $this->query() ->insert_many( $links ); } } e_id' ) ->where_in( 'target_indexable_id', $indexable_ids ) ->group_by( 'target_indexable_id' ) ->find_array(); // If the above query fails, do not update anything. if ( ! \is_array( $indexable_counts ) ) { return []; } // Get all ID's returned from the query and set them as keys for easy access. $returned_ids = \array_flip( \array_column( $indexable_counts, 'target_indexable_id' ) ); // Loop over the original ID's and search them in the returned ID's. If they don't exist, add them with an incoming count of 0. foreach ( $indexable_ids as $id ) { // Cast the ID to string, as the arrays only contain stringified versions of the ID. $id = \strval( $id ); if ( isset( $returned_ids[ $id ] ) === false ) { $indexable_counts[] = [ 'incoming' => '0', 'target_indexable_id' => $id, ]; } } return $indexable_counts; } /** * Deletes all seo links for the given ids. * * @param int[] $ids The seo link ids. * * @return bool Whether or not the delete was succesfull. */ public function delete_many_by_id( $ids ) { return $this->query() ->where_in( 'id', $ids ) ->delete_many(); } /** * Insert multiple seo links. * * @param SEO_Links[] $links The seo links to be inserted. * * @return bool Whether or not the insert was succesfull. */ public function insert_many( $links ) { return $this->query() ->insert_many( $links ); } } e_id' ) ->where_in( 'target_indexable_id', $indexable_ids ) ->group_by( 'target_indexable_id' ) ->find_array(); // If the above query fails, do not update anything. if ( ! \is_array( $indexable_counts ) ) { return []; } // Get all ID's returned from the query and set them as keys for easy access. $returned_ids = \array_flip( \array_column( $indexable_counts, 'target_indexable_id' ) ); // Loop over the original ID's and search them in the returned ID's. If they don't exist, add them with an incoming count of 0. foreach ( $indexable_ids as $id ) { // Cast the ID to string, as the arrays only contain stringified versions of the ID. $id = \strval( $id ); if ( isset( $returned_ids[ $id ] ) === false ) { $indexable_counts[] = [ 'incoming' => '0', 'target_indexable_id' => $id, ]; } } return $indexable_counts; } /** * Deletes all seo links for the given ids. * * @param int[] $ids The seo link ids. * * @return bool Whether or not the delete was succesfull. */ public function delete_many_by_id( $ids ) { return $this->query() ->where_in( 'id', $ids ) ->delete_many(); } /** * Insert multiple seo links. * * @param SEO_Links[] $links The seo links to be inserted. * * @return bool Whether or not the insert was succesfull. */ public function insert_many( $links ) { return $this->query() ->insert_many( $links ); } } e_id' ) ->where_in( 'target_indexable_id', $indexable_ids ) ->group_by( 'target_indexable_id' ) ->find_array(); // If the above query fails, do not update anything. if ( ! \is_array( $indexable_counts ) ) { return []; } // Get all ID's returned from the query and set them as keys for easy access. $returned_ids = \array_flip( \array_column( $indexable_counts, 'target_indexable_id' ) ); // Loop over the original ID's and search them in the returned ID's. If they don't exist, add them with an incoming count of 0. foreach ( $indexable_ids as $id ) { // Cast the ID to string, as the arrays only contain stringified versions of the ID. $id = \strval( $id ); if ( isset( $returned_ids[ $id ] ) === false ) { $indexable_counts[] = [ 'incoming' => '0', 'target_indexable_id' => $id, ]; } } return $indexable_counts; } /** * Deletes all seo links for the given ids. * * @param int[] $ids The seo link ids. * * @return bool Whether or not the delete was succesfull. */ public function delete_many_by_id( $ids ) { return $this->query() ->where_in( 'id', $ids ) ->delete_many(); } /** * Insert multiple seo links. * * @param SEO_Links[] $links The seo links to be inserted. * * @return bool Whether or not the insert was succesfull. */ public function insert_many( $links ) { return $this->query() ->insert_many( $links ); } } e_id' ) ->where_in( 'target_indexable_id', $indexable_ids ) ->group_by( 'target_indexable_id' ) ->find_array(); // If the above query fails, do not update anything. if ( ! \is_array( $indexable_counts ) ) { return []; } // Get all ID's returned from the query and set them as keys for easy access. $returned_ids = \array_flip( \array_column( $indexable_counts, 'target_indexable_id' ) ); // Loop over the original ID's and search them in the returned ID's. If they don't exist, add them with an incoming count of 0. foreach ( $indexable_ids as $id ) { // Cast the ID to string, as the arrays only contain stringified versions of the ID. $id = \strval( $id ); if ( isset( $returned_ids[ $id ] ) === false ) { $indexable_counts[] = [ 'incoming' => '0', 'target_indexable_id' => $id, ]; } } return $indexable_counts; } /** * Deletes all seo links for the given ids. * * @param int[] $ids The seo link ids. * * @return bool Whether or not the delete was succesfull. */ public function delete_many_by_id( $ids ) { return $this->query() ->where_in( 'id', $ids ) ->delete_many(); } /** * Insert multiple seo links. * * @param SEO_Links[] $links The seo links to be inserted. * * @return bool Whether or not the insert was succesfull. */ public function insert_many( $links ) { return $this->query() ->insert_many( $links ); } } e_id' ) ->where_in( 'target_indexable_id', $indexable_ids ) ->group_by( 'target_indexable_id' ) ->find_array(); // If the above query fails, do not update anything. if ( ! \is_array( $indexable_counts ) ) { return []; } // Get all ID's returned from the query and set them as keys for easy access. $returned_ids = \array_flip( \array_column( $indexable_counts, 'target_indexable_id' ) ); // Loop over the original ID's and search them in the returned ID's. If they don't exist, add them with an incoming count of 0. foreach ( $indexable_ids as $id ) { // Cast the ID to string, as the arrays only contain stringified versions of the ID. $id = \strval( $id ); if ( isset( $returned_ids[ $id ] ) === false ) { $indexable_counts[] = [ 'incoming' => '0', 'target_indexable_id' => $id, ]; } } return $indexable_counts; } /** * Deletes all seo links for the given ids. * * @param int[] $ids The seo link ids. * * @return bool Whether or not the delete was succesfull. */ public function delete_many_by_id( $ids ) { return $this->query() ->where_in( 'id', $ids ) ->delete_many(); } /** * Insert multiple seo links. * * @param SEO_Links[] $links The seo links to be inserted. * * @return bool Whether or not the insert was succesfull. */ public function insert_many( $links ) { return $this->query() ->insert_many( $links ); } } e_id' ) ->where_in( 'target_indexable_id', $indexable_ids ) ->group_by( 'target_indexable_id' ) ->find_array(); // If the above query fails, do not update anything. if ( ! \is_array( $indexable_counts ) ) { return []; } // Get all ID's returned from the query and set them as keys for easy access. $returned_ids = \array_flip( \array_column( $indexable_counts, 'target_indexable_id' ) ); // Loop over the original ID's and search them in the returned ID's. If they don't exist, add them with an incoming count of 0. foreach ( $indexable_ids as $id ) { // Cast the ID to string, as the arrays only contain stringified versions of the ID. $id = \strval( $id ); if ( isset( $returned_ids[ $id ] ) === false ) { $indexable_counts[] = [ 'incoming' => '0', 'target_indexable_id' => $id, ]; } } return $indexable_counts; } /** * Deletes all seo links for the given ids. * * @param int[] $ids The seo link ids. * * @return bool Whether or not the delete was succesfull. */ public function delete_many_by_id( $ids ) { return $this->query() ->where_in( 'id', $ids ) ->delete_many(); } /** * Insert multiple seo links. * * @param SEO_Links[] $links The seo links to be inserted. * * @return bool Whether or not the insert was succesfull. */ public function insert_many( $links ) { return $this->query() ->insert_many( $links ); } } e_id' ) ->where_in( 'target_indexable_id', $indexable_ids ) ->group_by( 'target_indexable_id' ) ->find_array(); // If the above query fails, do not update anything. if ( ! \is_array( $indexable_counts ) ) { return []; } // Get all ID's returned from the query and set them as keys for easy access. $returned_ids = \array_flip( \array_column( $indexable_counts, 'target_indexable_id' ) ); // Loop over the original ID's and search them in the returned ID's. If they don't exist, add them with an incoming count of 0. foreach ( $indexable_ids as $id ) { // Cast the ID to string, as the arrays only contain stringified versions of the ID. $id = \strval( $id ); if ( isset( $returned_ids[ $id ] ) === false ) { $indexable_counts[] = [ 'incoming' => '0', 'target_indexable_id' => $id, ]; } } return $indexable_counts; } /** * Deletes all seo links for the given ids. * * @param int[] $ids The seo link ids. * * @return bool Whether or not the delete was succesfull. */ public function delete_many_by_id( $ids ) { return $this->query() ->where_in( 'id', $ids ) ->delete_many(); } /** * Insert multiple seo links. * * @param SEO_Links[] $links The seo links to be inserted. * * @return bool Whether or not the insert was succesfull. */ public function insert_many( $links ) { return $this->query() ->insert_many( $links ); } } e_id' ) ->where_in( 'target_indexable_id', $indexable_ids ) ->group_by( 'target_indexable_id' ) ->find_array(); // If the above query fails, do not update anything. if ( ! \is_array( $indexable_counts ) ) { return []; } // Get all ID's returned from the query and set them as keys for easy access. $returned_ids = \array_flip( \array_column( $indexable_counts, 'target_indexable_id' ) ); // Loop over the original ID's and search them in the returned ID's. If they don't exist, add them with an incoming count of 0. foreach ( $indexable_ids as $id ) { // Cast the ID to string, as the arrays only contain stringified versions of the ID. $id = \strval( $id ); if ( isset( $returned_ids[ $id ] ) === false ) { $indexable_counts[] = [ 'incoming' => '0', 'target_indexable_id' => $id, ]; } } return $indexable_counts; } /** * Deletes all seo links for the given ids. * * @param int[] $ids The seo link ids. * * @return bool Whether or not the delete was succesfull. */ public function delete_many_by_id( $ids ) { return $this->query() ->where_in( 'id', $ids ) ->delete_many(); } /** * Insert multiple seo links. * * @param SEO_Links[] $links The seo links to be inserted. * * @return bool Whether or not the insert was succesfull. */ public function insert_many( $links ) { return $this->query() ->insert_many( $links ); } } e_id' ) ->where_in( 'target_indexable_id', $indexable_ids ) ->group_by( 'target_indexable_id' ) ->find_array(); // If the above query fails, do not update anything. if ( ! \is_array( $indexable_counts ) ) { return []; } // Get all ID's returned from the query and set them as keys for easy access. $returned_ids = \array_flip( \array_column( $indexable_counts, 'target_indexable_id' ) ); // Loop over the original ID's and search them in the returned ID's. If they don't exist, add them with an incoming count of 0. foreach ( $indexable_ids as $id ) { // Cast the ID to string, as the arrays only contain stringified versions of the ID. $id = \strval( $id ); if ( isset( $returned_ids[ $id ] ) === false ) { $indexable_counts[] = [ 'incoming' => '0', 'target_indexable_id' => $id, ]; } } return $indexable_counts; } /** * Deletes all seo links for the given ids. * * @param int[] $ids The seo link ids. * * @return bool Whether or not the delete was succesfull. */ public function delete_many_by_id( $ids ) { return $this->query() ->where_in( 'id', $ids ) ->delete_many(); } /** * Insert multiple seo links. * * @param SEO_Links[] $links The seo links to be inserted. * * @return bool Whether or not the insert was succesfull. */ public function insert_many( $links ) { return $this->query() ->insert_many( $links ); } } e_id' ) ->where_in( 'target_indexable_id', $indexable_ids ) ->group_by( 'target_indexable_id' ) ->find_array(); // If the above query fails, do not update anything. if ( ! \is_array( $indexable_counts ) ) { return []; } // Get all ID's returned from the query and set them as keys for easy access. $returned_ids = \array_flip( \array_column( $indexable_counts, 'target_indexable_id' ) ); // Loop over the original ID's and search them in the returned ID's. If they don't exist, add them with an incoming count of 0. foreach ( $indexable_ids as $id ) { // Cast the ID to string, as the arrays only contain stringified versions of the ID. $id = \strval( $id ); if ( isset( $returned_ids[ $id ] ) === false ) { $indexable_counts[] = [ 'incoming' => '0', 'target_indexable_id' => $id, ]; } } return $indexable_counts; } /** * Deletes all seo links for the given ids. * * @param int[] $ids The seo link ids. * * @return bool Whether or not the delete was succesfull. */ public function delete_many_by_id( $ids ) { return $this->query() ->where_in( 'id', $ids ) ->delete_many(); } /** * Insert multiple seo links. * * @param SEO_Links[] $links The seo links to be inserted. * * @return bool Whether or not the insert was succesfull. */ public function insert_many( $links ) { return $this->query() ->insert_many( $links ); } } e_id' ) ->where_in( 'target_indexable_id', $indexable_ids ) ->group_by( 'target_indexable_id' ) ->find_array(); // If the above query fails, do not update anything. if ( ! \is_array( $indexable_counts ) ) { return []; } // Get all ID's returned from the query and set them as keys for easy access. $returned_ids = \array_flip( \array_column( $indexable_counts, 'target_indexable_id' ) ); // Loop over the original ID's and search them in the returned ID's. If they don't exist, add them with an incoming count of 0. foreach ( $indexable_ids as $id ) { // Cast the ID to string, as the arrays only contain stringified versions of the ID. $id = \strval( $id ); if ( isset( $returned_ids[ $id ] ) === false ) { $indexable_counts[] = [ 'incoming' => '0', 'target_indexable_id' => $id, ]; } } return $indexable_counts; } /** * Deletes all seo links for the given ids. * * @param int[] $ids The seo link ids. * * @return bool Whether or not the delete was succesfull. */ public function delete_many_by_id( $ids ) { return $this->query() ->where_in( 'id', $ids ) ->delete_many(); } /** * Insert multiple seo links. * * @param SEO_Links[] $links The seo links to be inserted. * * @return bool Whether or not the insert was succesfull. */ public function insert_many( $links ) { return $this->query() ->insert_many( $links ); } } e_id' ) ->where_in( 'target_indexable_id', $indexable_ids ) ->group_by( 'target_indexable_id' ) ->find_array(); // If the above query fails, do not update anything. if ( ! \is_array( $indexable_counts ) ) { return []; } // Get all ID's returned from the query and set them as keys for easy access. $returned_ids = \array_flip( \array_column( $indexable_counts, 'target_indexable_id' ) ); // Loop over the original ID's and search them in the returned ID's. If they don't exist, add them with an incoming count of 0. foreach ( $indexable_ids as $id ) { // Cast the ID to string, as the arrays only contain stringified versions of the ID. $id = \strval( $id ); if ( isset( $returned_ids[ $id ] ) === false ) { $indexable_counts[] = [ 'incoming' => '0', 'target_indexable_id' => $id, ]; } } return $indexable_counts; } /** * Deletes all seo links for the given ids. * * @param int[] $ids The seo link ids. * * @return bool Whether or not the delete was succesfull. */ public function delete_many_by_id( $ids ) { return $this->query() ->where_in( 'id', $ids ) ->delete_many(); } /** * Insert multiple seo links. * * @param SEO_Links[] $links The seo links to be inserted. * * @return bool Whether or not the insert was succesfull. */ public function insert_many( $links ) { return $this->query() ->insert_many( $links ); } } e_id' ) ->where_in( 'target_indexable_id', $indexable_ids ) ->group_by( 'target_indexable_id' ) ->find_array(); // If the above query fails, do not update anything. if ( ! \is_array( $indexable_counts ) ) { return []; } // Get all ID's returned from the query and set them as keys for easy access. $returned_ids = \array_flip( \array_column( $indexable_counts, 'target_indexable_id' ) ); // Loop over the original ID's and search them in the returned ID's. If they don't exist, add them with an incoming count of 0. foreach ( $indexable_ids as $id ) { // Cast the ID to string, as the arrays only contain stringified versions of the ID. $id = \strval( $id ); if ( isset( $returned_ids[ $id ] ) === false ) { $indexable_counts[] = [ 'incoming' => '0', 'target_indexable_id' => $id, ]; } } return $indexable_counts; } /** * Deletes all seo links for the given ids. * * @param int[] $ids The seo link ids. * * @return bool Whether or not the delete was succesfull. */ public function delete_many_by_id( $ids ) { return $this->query() ->where_in( 'id', $ids ) ->delete_many(); } /** * Insert multiple seo links. * * @param SEO_Links[] $links The seo links to be inserted. * * @return bool Whether or not the insert was succesfull. */ public function insert_many( $links ) { return $this->query() ->insert_many( $links ); } } e_id' ) ->where_in( 'target_indexable_id', $indexable_ids ) ->group_by( 'target_indexable_id' ) ->find_array(); // If the above query fails, do not update anything. if ( ! \is_array( $indexable_counts ) ) { return []; } // Get all ID's returned from the query and set them as keys for easy access. $returned_ids = \array_flip( \array_column( $indexable_counts, 'target_indexable_id' ) ); // Loop over the original ID's and search them in the returned ID's. If they don't exist, add them with an incoming count of 0. foreach ( $indexable_ids as $id ) { // Cast the ID to string, as the arrays only contain stringified versions of the ID. $id = \strval( $id ); if ( isset( $returned_ids[ $id ] ) === false ) { $indexable_counts[] = [ 'incoming' => '0', 'target_indexable_id' => $id, ]; } } return $indexable_counts; } /** * Deletes all seo links for the given ids. * * @param int[] $ids The seo link ids. * * @return bool Whether or not the delete was succesfull. */ public function delete_many_by_id( $ids ) { return $this->query() ->where_in( 'id', $ids ) ->delete_many(); } /** * Insert multiple seo links. * * @param SEO_Links[] $links The seo links to be inserted. * * @return bool Whether or not the insert was succesfull. */ public function insert_many( $links ) { return $this->query() ->insert_many( $links ); } } e_id' ) ->where_in( 'target_indexable_id', $indexable_ids ) ->group_by( 'target_indexable_id' ) ->find_array(); // If the above query fails, do not update anything. if ( ! \is_array( $indexable_counts ) ) { return []; } // Get all ID's returned from the query and set them as keys for easy access. $returned_ids = \array_flip( \array_column( $indexable_counts, 'target_indexable_id' ) ); // Loop over the original ID's and search them in the returned ID's. If they don't exist, add them with an incoming count of 0. foreach ( $indexable_ids as $id ) { // Cast the ID to string, as the arrays only contain stringified versions of the ID. $id = \strval( $id ); if ( isset( $returned_ids[ $id ] ) === false ) { $indexable_counts[] = [ 'incoming' => '0', 'target_indexable_id' => $id, ]; } } return $indexable_counts; } /** * Deletes all seo links for the given ids. * * @param int[] $ids The seo link ids. * * @return bool Whether or not the delete was succesfull. */ public function delete_many_by_id( $ids ) { return $this->query() ->where_in( 'id', $ids ) ->delete_many(); } /** * Insert multiple seo links. * * @param SEO_Links[] $links The seo links to be inserted. * * @return bool Whether or not the insert was succesfull. */ public function insert_many( $links ) { return $this->query() ->insert_many( $links ); } } e_id' ) ->where_in( 'target_indexable_id', $indexable_ids ) ->group_by( 'target_indexable_id' ) ->find_array(); // If the above query fails, do not update anything. if ( ! \is_array( $indexable_counts ) ) { return []; } // Get all ID's returned from the query and set them as keys for easy access. $returned_ids = \array_flip( \array_column( $indexable_counts, 'target_indexable_id' ) ); // Loop over the original ID's and search them in the returned ID's. If they don't exist, add them with an incoming count of 0. foreach ( $indexable_ids as $id ) { // Cast the ID to string, as the arrays only contain stringified versions of the ID. $id = \strval( $id ); if ( isset( $returned_ids[ $id ] ) === false ) { $indexable_counts[] = [ 'incoming' => '0', 'target_indexable_id' => $id, ]; } } return $indexable_counts; } /** * Deletes all seo links for the given ids. * * @param int[] $ids The seo link ids. * * @return bool Whether or not the delete was succesfull. */ public function delete_many_by_id( $ids ) { return $this->query() ->where_in( 'id', $ids ) ->delete_many(); } /** * Insert multiple seo links. * * @param SEO_Links[] $links The seo links to be inserted. * * @return bool Whether or not the insert was succesfull. */ public function insert_many( $links ) { return $this->query() ->insert_many( $links ); } } e_id' ) ->where_in( 'target_indexable_id', $indexable_ids ) ->group_by( 'target_indexable_id' ) ->find_array(); // If the above query fails, do not update anything. if ( ! \is_array( $indexable_counts ) ) { return []; } // Get all ID's returned from the query and set them as keys for easy access. $returned_ids = \array_flip( \array_column( $indexable_counts, 'target_indexable_id' ) ); // Loop over the original ID's and search them in the returned ID's. If they don't exist, add them with an incoming count of 0. foreach ( $indexable_ids as $id ) { // Cast the ID to string, as the arrays only contain stringified versions of the ID. $id = \strval( $id ); if ( isset( $returned_ids[ $id ] ) === false ) { $indexable_counts[] = [ 'incoming' => '0', 'target_indexable_id' => $id, ]; } } return $indexable_counts; } /** * Deletes all seo links for the given ids. * * @param int[] $ids The seo link ids. * * @return bool Whether or not the delete was succesfull. */ public function delete_many_by_id( $ids ) { return $this->query() ->where_in( 'id', $ids ) ->delete_many(); } /** * Insert multiple seo links. * * @param SEO_Links[] $links The seo links to be inserted. * * @return bool Whether or not the insert was succesfull. */ public function insert_many( $links ) { return $this->query() ->insert_many( $links ); } } e_id' ) ->where_in( 'target_indexable_id', $indexable_ids ) ->group_by( 'target_indexable_id' ) ->find_array(); // If the above query fails, do not update anything. if ( ! \is_array( $indexable_counts ) ) { return []; } // Get all ID's returned from the query and set them as keys for easy access. $returned_ids = \array_flip( \array_column( $indexable_counts, 'target_indexable_id' ) ); // Loop over the original ID's and search them in the returned ID's. If they don't exist, add them with an incoming count of 0. foreach ( $indexable_ids as $id ) { // Cast the ID to string, as the arrays only contain stringified versions of the ID. $id = \strval( $id ); if ( isset( $returned_ids[ $id ] ) === false ) { $indexable_counts[] = [ 'incoming' => '0', 'target_indexable_id' => $id, ]; } } return $indexable_counts; } /** * Deletes all seo links for the given ids. * * @param int[] $ids The seo link ids. * * @return bool Whether or not the delete was succesfull. */ public function delete_many_by_id( $ids ) { return $this->query() ->where_in( 'id', $ids ) ->delete_many(); } /** * Insert multiple seo links. * * @param SEO_Links[] $links The seo links to be inserted. * * @return bool Whether or not the insert was succesfull. */ public function insert_many( $links ) { return $this->query() ->insert_many( $links ); } } e_id' ) ->where_in( 'target_indexable_id', $indexable_ids ) ->group_by( 'target_indexable_id' ) ->find_array(); // If the above query fails, do not update anything. if ( ! \is_array( $indexable_counts ) ) { return []; } // Get all ID's returned from the query and set them as keys for easy access. $returned_ids = \array_flip( \array_column( $indexable_counts, 'target_indexable_id' ) ); // Loop over the original ID's and search them in the returned ID's. If they don't exist, add them with an incoming count of 0. foreach ( $indexable_ids as $id ) { // Cast the ID to string, as the arrays only contain stringified versions of the ID. $id = \strval( $id ); if ( isset( $returned_ids[ $id ] ) === false ) { $indexable_counts[] = [ 'incoming' => '0', 'target_indexable_id' => $id, ]; } } return $indexable_counts; } /** * Deletes all seo links for the given ids. * * @param int[] $ids The seo link ids. * * @return bool Whether or not the delete was succesfull. */ public function delete_many_by_id( $ids ) { return $this->query() ->where_in( 'id', $ids ) ->delete_many(); } /** * Insert multiple seo links. * * @param SEO_Links[] $links The seo links to be inserted. * * @return bool Whether or not the insert was succesfull. */ public function insert_many( $links ) { return $this->query() ->insert_many( $links ); } } e_id' ) ->where_in( 'target_indexable_id', $indexable_ids ) ->group_by( 'target_indexable_id' ) ->find_array(); // If the above query fails, do not update anything. if ( ! \is_array( $indexable_counts ) ) { return []; } // Get all ID's returned from the query and set them as keys for easy access. $returned_ids = \array_flip( \array_column( $indexable_counts, 'target_indexable_id' ) ); // Loop over the original ID's and search them in the returned ID's. If they don't exist, add them with an incoming count of 0. foreach ( $indexable_ids as $id ) { // Cast the ID to string, as the arrays only contain stringified versions of the ID. $id = \strval( $id ); if ( isset( $returned_ids[ $id ] ) === false ) { $indexable_counts[] = [ 'incoming' => '0', 'target_indexable_id' => $id, ]; } } return $indexable_counts; } /** * Deletes all seo links for the given ids. * * @param int[] $ids The seo link ids. * * @return bool Whether or not the delete was succesfull. */ public function delete_many_by_id( $ids ) { return $this->query() ->where_in( 'id', $ids ) ->delete_many(); } /** * Insert multiple seo links. * * @param SEO_Links[] $links The seo links to be inserted. * * @return bool Whether or not the insert was succesfull. */ public function insert_many( $links ) { return $this->query() ->insert_many( $links ); } }
Fatal error: Uncaught Error: Class "Yoast\WP\SEO\Repositories\SEO_Links_Repository" not found in /htdocs/wp-content/plugins/wordpress-seo/src/generated/container.php:2175 Stack trace: #0 /htdocs/wp-content/plugins/wordpress-seo/src/generated/container.php(2084): Yoast\WP\SEO\Generated\Cached_Container->getIndexableLinkBuilderService() #1 /htdocs/wp-content/plugins/wordpress-seo/src/generated/container.php(5947): Yoast\WP\SEO\Generated\Cached_Container->getIndexableBuilderService() #2 /htdocs/wp-content/plugins/wordpress-seo/vendor_prefixed/symfony/dependency-injection/Container.php(271): Yoast\WP\SEO\Generated\Cached_Container->getIndexableRepositoryService() #3 /htdocs/wp-content/plugins/wordpress-seo/src/surfaces/classes-surface.php(38): YoastSEO_Vendor\Symfony\Component\DependencyInjection\Container->get('Yoast\\WP\\SEO\\Re...') #4 /htdocs/wp-content/plugins/wordpress-seo/inc/class-wpseo-admin-bar-menu.php(133): Yoast\WP\SEO\Surfaces\Classes_Surface->get('Yoast\\WP\\SEO\\Re...') #5 /htdocs/wp-content/plugins/wordpress-seo/inc/wpseo-non-ajax-functions.php(20): WPSEO_Admin_Bar_Menu->__construct() #6 /htdocs/wp-includes/class-wp-hook.php(324): wpseo_initialize_admin_bar('') #7 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #8 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #9 /htdocs/wp-settings.php(749): do_action('wp_loaded') #10 /htdocs/wp-config.php(101): require_once('/htdocs/wp-sett...') #11 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #12 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #13 /htdocs/index.php(17): require('/htdocs/wp-blog...') #14 {main} thrown in /htdocs/wp-content/plugins/wordpress-seo/src/generated/container.php on line 2175