Forums

[resolved] Custom Post Type - Permalink 404 (2 posts)

  1. ryanve
    Member
    Posted 1 year ago #

    My WordPress installation is in the directory /blog/. I've successfully added the custom post type case_study in functions.php using this code: http://pastebin.com/rFwkfUmV

    which gave this permalink structure:

    .../blog/?case_study=hello-world

    I changed the rewrite argument to

    'rewrite' => true,

    which successfully changed the permalink structure to:

    .../blog/case_study/hello-world/

    but it gives a 404 error saying

    You tried going to .../blog/blog/case_study/hello-world/, and it doesn't exist.

    I then modified it again like so:

    'rewrite' => array('slug' => 'case_study', 'with_front' => true, ),

    and still got the same 404.

    Any idea on how to fix this?

  2. ryanve
    Member
    Posted 1 year ago #

    Problem solved by temporarily add flush_rewrite_rules(); as described here.
    I think the method in this article would work too: "Simply visit your Settings > Permalinks page. You don’t have to save your permalinks but just visit the page. This will flush your rewrite rules."

Topic Closed

This topic has been closed to new replies.

About this Topic