WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post Type UI
[resolved] Custom rewrite slug "none" option | 404 error when "/&q (4 posts)

  1. dermotholmes
    Member
    Posted 2 years ago #

    Is there a way to have the custom rewrite slug of a custom post type set to nothing i.e. so you can have:

    yourwebsite.com/pagename

    instead of:

    yourwebsite.com/custom_post_type_name/pagename

    If I enter '/' in the rewrite slug field of the custom post type ui editing window it breaks the permalinks for normal pages (they return a wp 404 page).

    Has anyone had any success setting an empty rewrite slug through the custom post type ui menu/admin area?

    Cheers
    D

    http://wordpress.org/extend/plugins/custom-post-type-ui/

  2. typeshape
    Member
    Posted 2 years ago #

    Any luck with this one Dermot? I, too would like to completely remove the slug and just have /postname etc

  3. dermotholmes
    Member
    Posted 2 years ago #

    No no luck, I ended up abandoning custom post types completely. This isn't Custom Post Types UI fault it's got to do with the way WordPress handles custom post types (CPT's). I'm pretty much putting CPT's aside until WordPress reworks them so their not second class citizens.

    The solution I'm using now is using the Advanced Custom Fields plugin to show the extra fields I need for different page 'types' (even though their all wordpress 'pages').

    I'm using this in conjunction with wordpress's native page templates. Advanced Custom Fields can be set to show and hide groups of custom/extra fields depending on the page template selected.

    From the user's perspective picking the page template sort of is like declaring that page to be a specific 'type' of page. It's one extra thing for the user to do but it gets me what I want and lets the urls pan out however you like.

    Hope that helps you out a little bit!

  4. Daedalon
    Member
    Posted 2 years ago #

    I think what you intend can be done by adding your own custom rewrite. As far as I've found out, there is no good plugin for this yet, only Monkeyman Rewrite Analyzer that lets you see which rewrites are active.

    In other words you'd need to make a custom plugin or add the rewrite code to your theme's functions.php and be careful with theme updates.

    The idea is to add a rewrite so that if 'something' in a URL of http://yoursite/something does not match the postname of a regular post, WordPress would then search for a matching postname of your custom post type.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.