Title: 404 error
Last modified: August 19, 2024

---

# 404 error

 *  Resolved [delweratjk](https://wordpress.org/support/users/delweratjk/)
 * (@delweratjk)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/404-error-441/)
 * I used both of the options but same error. What’s wrong with the plugin?
 * [https://prnt.sc/9S7z8AIJJrVR](https://prnt.sc/9S7z8AIJJrVR)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [kubiq](https://wordpress.org/support/users/kubiq/)
 * (@kubiq)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/404-error-441/#post-17962199)
 * There is nothing wrong with the plugin 😉
 * Have you tried without alternation?
 * Maybe also try to resave your permalinks.
 * Maybe the way how you register your CPTs is not standard,
   or there is another
   plugin conflicting with URLs…
 * You need to provide more data if you need help.
 *  Thread Starter [delweratjk](https://wordpress.org/support/users/delweratjk/)
 * (@delweratjk)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/404-error-441/#post-17962205)
 *     ```wp-block-code
       <?php/** * Class Docs */class Docs {    /**     * The post type name.     *     * @var string     */    private $post_type = 'docs';    /**     * Initialize the class     */    public function __construct() {        add_action( 'init', [ $this, 'register_post_type' ] );        add_action( 'init', [ $this, 'register_taxonomy' ] );        add_action( 'init', [ $this, 'register_badge' ] );    }    /**     * Register the post type.     *     * @return void     */    public function register_post_type() {        /**         * Docs slug         * @var string         */        $settings_options   = get_option( 'eazydocs_settings' );        $custom_slug        = $settings_options['docs-type-slug'] ?? '';        // Validate the slug        $pattern            = '/[^a-zA-Z0-9-_]/';        $safe_slug          = preg_replace( $pattern, '-', $custom_slug );              $slug               = $safe_slug ?? 'docs';        // Docs URL structure        $docs_url           = ezd_get_opt('docs-url-structure', 'custom-slug');        if ( ezd_is_premium() && $docs_url == 'post-name' ) {                  $rewrite = [                'slug'       => '/',                'with_front' => true,                'pages'      => true,                'feeds'      => true,            ];        } else {                        $rewrite = [                'slug'       => $slug,                'with_front' => true,                'pages'      => true,                'feeds'      => true,            ];                  }        $labels = [            'name'               => _x( 'Docs', 'Post Type General Name', 'eazydocs' ),            'singular_name'      => _x( 'Doc', 'Post Type Singular Name', 'eazydocs' ),            'menu_name'          => __( 'EazyDocs', 'eazydocs' ),            'parent_item_colon'  => __( 'Parent Doc', 'eazydocs' ),            'all_items'          => __( 'All Docs', 'eazydocs' ),            'view_item'          => __( 'View Doc', 'eazydocs' ),            'add_new_item'       => __( 'Add Doc', 'eazydocs' ),            'add_new'            => __( 'Add New', 'eazydocs' ),            'edit_item'          => __( 'Edit Doc', 'eazydocs' ),            'update_item'        => __( 'Update Doc', 'eazydocs' ),            'search_items'       => __( 'Search Doc', 'eazydocs' ),            'not_found'          => __( 'Not Doc found', 'eazydocs' ),            'not_found_in_trash' => __( 'Not found in Trash', 'eazydocs' ),        ];        $args = [            'labels'              => $labels,            'supports'            => [ 'title', 'editor', 'thumbnail', 'revisions', 'page-attributes', 'comments', 'author', 'excerpt', 'blocks' ],            'hierarchical'        => true,            'public'              => true,            'show_ui'             => true,            'show_in_menu'        => false,            'show_in_nav_menus'   => true,            'show_in_admin_bar'   => true,            'menu_icon'           => 'dashicons-media-document',            'can_export'          => true,            'has_archive'         => false,            'exclude_from_search' => false,            'publicly_queryable'  => true,            'show_in_rest'        => true,            'rewrite'             => $rewrite,            'map_meta_cap'        => true,            'taxonomies'          => [ 'doc_tag' ]        ];        register_post_type( $this->post_type, apply_filters( 'eazydocs_post_type', $args ) );    }    /**     * Register doc tags taxonomy.     *     * @return void     */    public function register_taxonomy() {        $labels = [            'name'                       => _x( 'Tags', 'Taxonomy General Name', 'eazydocs' ),            'singular_name'              => _x( 'Tag', 'Taxonomy Singular Name', 'eazydocs' ),            'menu_name'                  => __( 'Tags', 'eazydocs' ),            'all_items'                  => __( 'All Tags', 'eazydocs' ),            'parent_item'                => __( 'Parent Tag', 'eazydocs' ),            'parent_item_colon'          => __( 'Parent Tag:', 'eazydocs' ),            'new_item_name'              => __( 'New Tag', 'eazydocs' ),            'add_new_item'               => __( 'Add New Item', 'eazydocs' ),            'edit_item'                  => __( 'Edit Tag', 'eazydocs' ),            'update_item'                => __( 'Update Tag', 'eazydocs' ),            'view_item'                  => __( 'View Tag', 'eazydocs' ),            'separate_items_with_commas' => __( 'Separate items with commas', 'eazydocs' ),            'add_or_remove_items'        => __( 'Add or remove items', 'eazydocs' ),            'choose_from_most_used'      => __( 'Choose from the most used', 'eazydocs' ),            'popular_items'              => __( 'Popular Tags', 'eazydocs' ),            'search_items'               => __( 'Search Tags', 'eazydocs' ),            'not_found'                  => __( 'Not Found', 'eazydocs' ),            'no_terms'                   => __( 'No items', 'eazydocs' ),            'items_list'                 => __( 'Tags list', 'eazydocs' ),            'items_list_navigation'      => __( 'Tags list navigation', 'eazydocs' ),        ];        $rewrite = [            'slug'         => 'doc-tag',            'with_front'   => true,            'hierarchical' => false,        ];        $args = [            'labels'            => $labels,            'hierarchical'      => false,            'public'            => true,            'show_ui'           => true,            'show_admin_column' => true,            'show_in_nav_menus' => true,            'show_tagcloud'     => true,            'show_in_rest'      => true,            'rewrite'           => $rewrite,        ];        register_taxonomy( 'doc_tag', [ 'docs' ], $args );    }Please check my code above.
       ```
   
 *  Plugin Author [kubiq](https://wordpress.org/support/users/kubiq/)
 * (@kubiq)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/404-error-441/#post-17962220)
 * That `'slug' => '/',` looks really weird, I’ve never seen such a thing and that
   can be the issue maybe?
 *  Thread Starter [delweratjk](https://wordpress.org/support/users/delweratjk/)
 * (@delweratjk)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/404-error-441/#post-17962223)
 * how to fix it? please update my code and provide me.
 *  Plugin Author [kubiq](https://wordpress.org/support/users/kubiq/)
 * (@kubiq)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/404-error-441/#post-17962232)
 * Just read the WP documentation:
   [https://developer.wordpress.org/reference/functions/register_post_type/](https://developer.wordpress.org/reference/functions/register_post_type/)
 * That `slug` should normally contain `$post_type key` and that can never be a `'/'`

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘404 error’ is closed to new replies.

 * ![](https://ps.w.org/remove-cpt-base/assets/icon-256x256.png?rev=1759289)
 * [Remove CPT base](https://wordpress.org/plugins/remove-cpt-base/)
 * [Support Threads](https://wordpress.org/support/plugin/remove-cpt-base/)
 * [Active Topics](https://wordpress.org/support/plugin/remove-cpt-base/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/remove-cpt-base/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/remove-cpt-base/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [kubiq](https://wordpress.org/support/users/kubiq/)
 * Last activity: [1 year, 9 months ago](https://wordpress.org/support/topic/404-error-441/#post-17962232)
 * Status: resolved