WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to have any child page url like http://www.foo.com/fooparent/foochild automatically turns into http://www.foo.com/fooparent/#foochild

Could this be done in the htaccess rewrite rules or can I directly change the way WordPress stores the slug name so I could add # in front of it?

Use case

I have the parent pages loading all the child pages content in the template. It's utilizing a onepage layout with anchor links scrolling down the page to each section as you navigate. There are cases where permalinks of the child pages are exposed and that would break the onepage functionality. A child permalink should just load it's parent page and add use its slug as a an #anchor in the URL.

share|improve this question
I'm curious why you'd want this, could you edit your question to ellaborate on what your use case is? – Tom J Nowell Apr 15 '14 at 20:32
I've added a use case. Any ideas on how to do this? – Tom Apr 15 '14 at 20:56
So like a flat website design. #About would scroll down the page until it hits the 'About Page' div, correct? – Howdy_McGee Apr 15 '14 at 21:29
@howdy_McGee correct. Whenever a childpage was created, it would prepend '#' to the slug. – Tom Apr 15 '14 at 22:16
You may be looking for an HTACCESS rule instead of a WordPress work around. – Howdy_McGee Apr 16 '14 at 0:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.