From 635a51e8b900e5ca82a70d6254dff6e7ca2b0e2d Mon Sep 17 00:00:00 2001
From: Al-Ameen Ogundiran <ogundiran12@gmail.com>
Date: Wed, 15 Jan 2025 18:11:52 +0000
Subject: [PATCH] remove wordads_second_belowpost

---
 projects/packages/sync/src/class-defaults.php     |  1 -
 projects/plugins/jetpack/_inc/client/earn/ads.jsx | 15 ---------------
 .../_inc/lib/class.core-rest-api-endpoints.php    |  7 -------
 .../jetpack/modules/wordads/class-wordads.php     |  3 ---
 .../modules/wordads/php/class-wordads-params.php  |  1 -
 .../php/sync/test_class.jetpack-sync-options.php  |  1 -
 6 files changed, 28 deletions(-)

diff --git a/projects/packages/sync/src/class-defaults.php b/projects/packages/sync/src/class-defaults.php
index 0d05b206c97b4..a070305690903 100644
--- a/projects/packages/sync/src/class-defaults.php
+++ b/projects/packages/sync/src/class-defaults.php
@@ -176,7 +176,6 @@ class Defaults {
 		'wordads_display_front_page',
 		'wordads_display_page',
 		'wordads_display_post',
-		'wordads_second_belowpost',
 		'wordads_inline_enabled',
 		'woocommerce_custom_orders_table_enabled',
 		'wp_mobile_app_promos',
diff --git a/projects/plugins/jetpack/_inc/client/earn/ads.jsx b/projects/plugins/jetpack/_inc/client/earn/ads.jsx
index d0fd4b7071547..0d6498e0b706e 100644
--- a/projects/plugins/jetpack/_inc/client/earn/ads.jsx
+++ b/projects/plugins/jetpack/_inc/client/earn/ads.jsx
@@ -119,10 +119,6 @@ export const Ads = withModuleSettingsFormHelpers(
 			const isAdsActive = this.props.getOptionValue( 'wordads' );
 			const unavailableInOfflineMode = this.props.isUnavailableInOfflineMode( 'wordads' );
 			const enable_header_ad = this.props.getOptionValue( 'enable_header_ad', 'wordads' );
-			const wordads_second_belowpost = this.props.getOptionValue(
-				'wordads_second_belowpost',
-				'wordads'
-			);
 			const wordads_inline_enabled = this.props.getOptionValue(
 				'wordads_inline_enabled',
 				'wordads'
@@ -263,17 +259,6 @@ export const Ads = withModuleSettingsFormHelpers(
 								onChange={ this.handleChange( 'enable_header_ad' ) }
 								label={ __( 'Top of each page', 'jetpack' ) }
 							/>
-							<ToggleControl
-								checked={ wordads_second_belowpost }
-								disabled={
-									! isAdsActive ||
-									unavailableInOfflineMode ||
-									this.props.isSavingAnyOption( [ 'wordads' ] )
-								}
-								toggling={ this.props.isSavingAnyOption( [ 'wordads_second_belowpost' ] ) }
-								onChange={ this.handleChange( 'wordads_second_belowpost' ) }
-								label={ __( 'Second ad below post', 'jetpack' ) }
-							/>
 							<ToggleControl
 								checked={ wordads_inline_enabled }
 								disabled={
diff --git a/projects/plugins/jetpack/_inc/lib/class.core-rest-api-endpoints.php b/projects/plugins/jetpack/_inc/lib/class.core-rest-api-endpoints.php
index e56d427c0c5ea..ec5204236cd2c 100644
--- a/projects/plugins/jetpack/_inc/lib/class.core-rest-api-endpoints.php
+++ b/projects/plugins/jetpack/_inc/lib/class.core-rest-api-endpoints.php
@@ -2871,13 +2871,6 @@ public static function get_updateable_data_list( $selector = '' ) {
 				'validate_callback' => __CLASS__ . '::validate_boolean',
 				'jp_group'          => 'wordads',
 			),
-			'wordads_second_belowpost'                  => array(
-				'description'       => esc_html__( 'Display second ad below post?', 'jetpack' ),
-				'type'              => 'boolean',
-				'default'           => 1,
-				'validate_callback' => __CLASS__ . '::validate_boolean',
-				'jp_group'          => 'wordads',
-			),
 			'wordads_inline_enabled'                    => array(
 				'description'       => esc_html__( 'Display inline ad within post content?', 'jetpack' ),
 				'type'              => 'boolean',
diff --git a/projects/plugins/jetpack/modules/wordads/class-wordads.php b/projects/plugins/jetpack/modules/wordads/class-wordads.php
index c02922d44d055..363bf8052a140 100644
--- a/projects/plugins/jetpack/modules/wordads/class-wordads.php
+++ b/projects/plugins/jetpack/modules/wordads/class-wordads.php
@@ -672,9 +672,6 @@ public function get_ad( $spot, $type = 'iponweb' ) {
 		} elseif ( 'house' === $type ) {
 			$leaderboard = 'top' === $spot && ! $this->params->mobile_device;
 			$snippet     = $this->get_house_ad( $leaderboard ? 'leaderboard' : 'mrec' );
-			if ( 'belowpost' === $spot && $this->option( 'wordads_second_belowpost', true ) ) {
-				$snippet .= $this->get_house_ad( $leaderboard ? 'leaderboard' : 'mrec' );
-			}
 		}
 
 		return $snippet;
diff --git a/projects/plugins/jetpack/modules/wordads/php/class-wordads-params.php b/projects/plugins/jetpack/modules/wordads/php/class-wordads-params.php
index 8707b1d43d871..291f385fffd74 100644
--- a/projects/plugins/jetpack/modules/wordads/php/class-wordads-params.php
+++ b/projects/plugins/jetpack/modules/wordads/php/class-wordads-params.php
@@ -91,7 +91,6 @@ public function __construct() {
 			'wordads_house'                        => true,
 			'wordads_unsafe'                       => false,
 			'enable_header_ad'                     => true,
-			'wordads_second_belowpost'             => true,
 			'wordads_inline_enabled'               => true,
 			'wordads_bottom_sticky_enabled'        => false,
 			'wordads_sidebar_sticky_right_enabled' => false,
diff --git a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-options.php b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-options.php
index 4855982f1ee3a..79b6de3325210 100644
--- a/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-options.php
+++ b/projects/plugins/jetpack/tests/php/sync/test_class.jetpack-sync-options.php
@@ -218,7 +218,6 @@ public function test_sync_default_options() {
 			'mailserver_port'                              => 1,
 			'wp_page_for_privacy_policy'                   => false,
 			'enable_header_ad'                             => '1',
-			'wordads_second_belowpost'                     => '1',
 			'wordads_inline_enabled'                       => true,
 			'wordads_cmp_enabled'                          => false,
 			'wordads_display_front_page'                   => '1',