Changing the current Post when loading single.php file

Question

I need the single.php file to be able to load a different Post (Into the POST object) and to consider the new Post as the current post.

Example:

  1. Current Post ID: 755
  2. Select Random Post ID: 748
  3. Load Random Post into Post Object (**** Need to know who to do this**)
  4. Current Post ID: 748

So, when you call get_the_ID() you will get the Random Post ID, in this example 748…

Note:

  • Not to be done with a redirect
  • Not to be done with basic Post array update, as post loaded needs to be considered as the Random Post

Context:
I am using specific posts as a Landing Page split test.

So when the Split Test page is loaded, I select a random post (landing page) to display.

So, I do not want the URL to change, I want the page to load, as the selected random post.

0
Lionel Thomas 2 months 0 Answers 5 views 0

Leave an answer