diff --git a/CRM/Core/Payment/AuthorizeNetIPN.php b/CRM/Core/Payment/AuthorizeNetIPN.php
index bcf56e15af1c..1cadb8f931dd 100644
--- a/CRM/Core/Payment/AuthorizeNetIPN.php
+++ b/CRM/Core/Payment/AuthorizeNetIPN.php
@@ -80,6 +80,7 @@ public function main($component = 'contribute') {
         if (!$contribution->find(TRUE)) {
           throw new CRM_Core_Exception('Failure: Could not find contribution record for ' . (int) $contribution->id, NULL, ['context' => "Could not find contribution record: {$contribution->id} in IPN request: " . print_r($input, TRUE)]);
         }
+        $ids['contributionPage'] = $contribution->contribution_page_id;
 
         // make sure contact exists and is valid
         // use the contact id from the contribution record as the id in the IPN may not be valid anymore.
@@ -106,13 +107,6 @@ public function main($component = 'contribute') {
         $objects['contact'] = &$contact;
         $objects['contribution'] = &$contribution;
 
-        // CRM-19478: handle oddity when p=null is set in place of contribution page ID,
-        if (!empty($ids['contributionPage']) && !is_numeric($ids['contributionPage'])) {
-          // We don't need to worry if about removing contribution page id as it will be set later in
-          //  CRM_Contribute_BAO_Contribution::loadRelatedObjects(..) using $objects['contribution']->contribution_page_id
-          unset($ids['contributionPage']);
-        }
-
         $this->loadObjects($input, $ids, $objects, TRUE, $paymentProcessorID);
 
         if (!empty($ids['paymentProcessor']) && $objects['contributionRecur']->payment_processor_id != $ids['paymentProcessor']) {
@@ -321,12 +315,6 @@ public function getIDs(&$ids, &$input) {
       throw new CRM_Core_Exception($message);
     }
 
-    // get page id based on contribution id
-    $ids['contributionPage'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution',
-      $ids['contribution'],
-      'contribution_page_id'
-    );
-
     if ($input['component'] == 'event') {
       // FIXME: figure out fields for event
     }
diff --git a/tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php b/tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php
index 269e3d519dbc..12ee0cdc5646 100644
--- a/tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php
+++ b/tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php
@@ -1,6 +1,7 @@
 <?php
 
 use Civi\Payment\Exception\PaymentProcessorException;
+use Civi\Api4\Contribution;
 
 /**
  * Class CRM_Core_Payment_PayPalProIPNTest
@@ -135,6 +136,11 @@ public function testIPNPaymentRecurNoReceipt() {
     $this->assertEquals(date('Y-m-d'), substr($updatedContributionRecurAgain['end_date'], 0, 10));
     // There should not be any email.
     $mut->assertMailLogEmpty();
+
+    $contributions = Contribution::get()->addWhere('contribution_recur_id', '=', $this->_contributionRecurID)->addSelect('contribution_page_id')->execute();
+    foreach ($contributions as $contribution) {
+      $this->assertEquals($this->_contributionPageID, $contribution['contribution_page_id']);
+    }
   }
 
   /**