I want to be able to search posts by id only in a specific page then automatically redirect users to the searched post. I've found Search Using Post ID answer, which still works. I've also found How to redirect search result page to post which completes my function requirement.
What I want is to combine both and make this whole functionality unique to page id 4629 and not throughout the site's search. Is this possible? How do I achieve that?
Here's what I tried to make this unique to the page so far:
is_search() in the first snippet but when tested returns no search results. I've also tried wrapping both snippets with
if(is_page(4629)) around them, then around each of them but that didn't get any search results too.