Support » Plugins » Remove base slug on Custom Post Type?

  • I know it’s possible to customize the base slug when registering a CPT, but is it possible to completely remove the base?

    E.g. I want to make the url example.com/headline/ rather than example.com/slugname/headline/

    This didn’t work:
    'rewrite' => array('slug' => '', 'with_front' => true, ),

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter ryanve

    (@ryanve)

    Whoa—this works:

    'rewrite' => array('slug' => '/'),

    It removes the slug w/o adding extra slashes.

    Are you sure it works ? I’m using WordPress 3.2.1 and it just go back to default URL using “?”

    It works for me on using Network 3.2.1. Does anyone know how to add a slug to pages to rule out any chance of conflicts?

    Thread Starter ryanve

    (@ryanve)

    When you want to add a slug to the CPT it’s like this:

    'rewrite' => array('slug' => 'myslug')

    But for pages, I’m not sure (aside from making child pages).

    It seems slugless CPTs can cause errors. I don’t recommend them. See thread.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove base slug on Custom Post Type?’ is closed to new replies.