Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress One Page WordPress Site

Michael Dixon
Michael Dixon
16,455 Points

Is there a way to make it so users cannot still directly go to a page by just typing it into the url?

Like I know we have the #about-us link on the homepage, but couldn't I just type in /about-us directly in the url still?

1 Answer

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

You could probably write a function in your functions.php that tests if you are on a single template or a specific page and uses wp_redirect to send you back to the homepage. Maybe tie into the template_redirect hook?