25

I have the following line in a register_post_type function:

'rewrite' => array('slug' => 'Newsletters', 'with_front' => false),

I understand what the line does in general (adds "newsletters" to the slug) but I don't specifically understand what the 'with_front' part does. I have to admit, I don't really have a problem that needs solving, but I'm suddenly curious....

  • I'm not sure why you would rename the slug if you don't plan on using it, but the slug is typically lowercase as it's the url. – tehlivi Apr 12 '17 at 18:40
  • 1
    I don't remember much from '12 so I don't have much follow-up. It was using the slug for sure... I just wasn't understanding what it was doing with it. I hate implementing code that I don't understand the mechanics of. – Greg Pettit Apr 13 '17 at 19:15
31

From the Codex ...

Should the permastruct be prepended with the front base. (example: if your permalink structure is /blog/, then your links will be: false->/news/, true->/blog/news/). Defaults to true

  • Thanks. I can never find anything directly on the Codex, and using web search was getting me nowhere! – Greg Pettit May 24 '12 at 19:21
  • 1
    I can always find everything with OLD Codex , but new DevelopersCodex seems poor. – T.Todua Feb 20 '17 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.