0
votes

I am building a WordPress theme in which the blog posts are made using a custom post type titled 'blogs'

The blog page is located at http://website.com/blog/ and when a post of type 'blogs' is posted, it is posted only to the /blog/ page. My problem is that when I click on a blog title to view the single blog the URL is redirected to http://website.com/post-title and not http://website.com/blog/post-title. But when I add 'rewrite' => array('slug' => 'blog') to the custom post type I get a 'Redirect Loop' error.

How can I make the post title append the current url with /blog/?

2

2 Answers

2
votes

Have you tried to refresh your permalink rewrite rules after adding that slug by visiting Settings → Permalinks in wp-admin? If that doesn't work, try hard flushing your rewrite rules (http://codex.wordpress.org/Function_Reference/flush_rewrite_rules).

0
votes

I'm not exactly sure why you're even creating a custom post type "blogs". Wordpress is essentially a blog by default. The permalink structure can be changed by going to Settings > Permalinks and updating the custom structure to /blog/%postname%/