What is the “with_front” rewrite key?

The question:

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

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

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


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment