Skip to content

with_front won’t add ‘false’ to cpt definition #7

@zenopopovici

Description

@zenopopovici

Hi,
I recently added /blog/ as part of my permastructure (intending it for blog posts only) and discovered that even though I had set “with_front” to False in all my custom post types, they were still getting /blog/ added to the URL. I dug through the code and discovered that if with_front is set to false, it doesn’t add anything to the cpt arguments, which doesn’t work because the default is true.

It appears to be due to line 259 (version 1.1.1):
if ( $cptm_withfront ) { $cptm_rewrite_options[‘with_front’] = $cptm_withfront; }

So if $sptm_withfront is False, it doesn’t set anything for $cptm_rewrite_options[‘with_front’]

I just eliminated the if statement and changed that line to:
$cptm_rewrite_options[‘with_front’] = $cptm_withfront;

and now I have http://www.example.com/blog/my-blog-post for blog posts and http://www.example.com/customslug/custom-post for everything else.

It’s very possible that I just missed or misunderstood something, so if there’s something I should be doing differently, can you let me know? If not, perhaps you’d want to change this line for the next release?

Thanks,
Carina

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions