Support » Fixing WordPress » Remove slug of CPT that's set as homepage (rewrite?)

  • Hi all,
    Since the homepage of the site is so completely different from the rest, I created a Custom Post Type (“homepage” -done with the Magic Fields 2 plugin) and added 1 “page”.
    The slug of this page is “http://localhost/vhh/homepage/homepage”

    In order to be able to show this CPT as the default homepage, I wrote a function that adds it to the drop-down menu in the admin area: Settings > Reading.
    This works. Now when I enter the address “http://localhost/vhh” I will automatically be redirected to “http://localhost/vhh/homepage/homepage”.

    BUT I’m not completely happy yet. I want to get rid of “/homepage/homepage”.

    Previously, when a normal “page” was the homepage, this did not happen. The homepage address would just stay “http://localhost/vhh”.

    I suppose this has something to do with a rewrite rule. I have found the function “add_rewrite_rule()”, but I can’t get it to work.

    Can anyone help?

  • The topic ‘Remove slug of CPT that's set as homepage (rewrite?)’ is closed to new replies.