I’m looking to make a URL like for example:
http://localhost/latest-news
Where the page for latest-news
will automatically redirect to the latest news article (article with news
category tag).
I then will need to use the link /latest-news in a few different places (menu, and a slider on the front page).
I’m going to list the steps below which worked for me:
Step 1) In the Admin Panel create a Page called “Latest News” which will have the slug you want
latest-news
.Step 2) In your Theme Folder create a blank file and save it as
page-latest-news.php
. Inside the file, add this:Step 3) Upload your
page-latest-news.php
file and test it out.I decided to go with 307 redirects because of the Temporary status, which I imagine the latest post will change frequently. Hope it works for you!