Remove CPT base

Description

Remove custom post type base slug from permalink url

  • auto-prevent slug duplicates
  • possibility to select only specific custom post types
  • auto redirect old slugs to no-base slugs
  • use remove_cpt_base_skip filter to skip conflicts – 2 arguments: $skip, $query

Installation

  1. Upload remove-cpt-base directory to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress

Reviews

Broken since 2.0

Version 1.2 worked well, but 2.0 created 404 links for all my CPT. I've since reverted back to 1.2, but hopefully this is fixed. It's possible there's a conflict with another plugin, but I haven't been able to track it down yet.
Read all 2 reviews

Contributors & Developers

“Remove CPT base” is open source software. The following people have contributed to this plugin.

Contributors

Translate “Remove CPT base” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

4.4

  • new filter for developers to skip RCPTB for some queries – use remove_cpt_base_skip with 2 arguments: $skip and $query
  • example for bbPress forums conflicts

    add_filter( ‘remove_cpt_base_skip’, ‘skip_rcptb’, 10, 2 );
    function skip_rcptb( $skip, $query ){
    if( isset( $query->query[‘post_type’] ) && $query->query[‘post_type’] === ‘forum’ ){
    $skip = true;
    }
    return $skip;
    }

4.3

  • fix for some endpoints and make sure post is not interpreted as attachment

4.2

  • fix for hierarchical CPTs on some servers

4.1

  • make it works for posts interpreted like category by WP

4.0

  • tested on WP 5.2
  • make it works for hierarchical post types and different permalink structures
  • going back to ‘pre_get_posts’
  • optimize generating slug for duplicate names

3.3

  • change HTTP code from 404 to 200

3.2

  • fix for query strings

3.1

  • add custom endpoint rewrites support

3.0

  • stop using complicated ‘pre_get_posts’ and handle 404 instead

2.3

  • tested on WP 5.0

2.2

  • fix 404

2.1

  • fix redirect loop in WPML and WooCommerce

2.0

  • stop using .htaccess rules

1.2

  • auto init after permalinks updated

1.1

  • add uninstall hook
  • add duplicate slug check
  • minor updates

1.0

  • First version