36

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....

2
  • 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, 2017 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. Apr 13, 2017 at 19:15

1 Answer 1

46

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

3
  • 1
    Thanks. I can never find anything directly on the Codex, and using web search was getting me nowhere! May 24, 2012 at 19:21
  • 4
    I can always find everything with OLD Codex , but new DevelopersCodex seems poor.
    – T.Todua
    Feb 20, 2017 at 8:32
  • 1
    +1 The old codex is way better even to this day. It's easier to read, more documentation on it, better examples and interpretation is way better. Not to mention easier on the eyes, as the new codex just gives a red flag to me on the eyes! Apr 8, 2020 at 1:55

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.