• Resolved jefsev

    (@jefsev)


    Hi,

    After a disabled the plugin all my pages gave a 404. So i thought i try and make new page or change the slug manually after deactivation. Neither works. Strange enough my custom post type archive and pages work fine with and after deativation.

    So seems the plugin broke something only with the default page post type.

    So to be clear even when i create a new page it still always gives a 404. I flushed the permalinks. I regenerated the default permalinks with your plugin i cleared everything with the debug tool, nothing fixes it. I cannot create any page anymore or use existing ones. Only when i activate your plugin do page work.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Maciej Bis

    (@mbis)

    Hi @jefsev,

    I am not 100% certain, but the problem might be with rewrite rules generated for custom post types. When custom post type is registered with empty “rewrite slug”, the rewrite rules for custom post items will overwrite the rewrite rules used for pages.

    My plugin does not change rewrite rules and could not change “rewrite slugs” for custom post types.

    • Did you registered custom post types after my plugin was activated?
    • Could you send me your permalink settings & let me know how exactly did you registered the custom post types (3rd party plugin/custom code)?

    Best regards,
    Maciej

    Thread Starter jefsev

    (@jefsev)

    Hey Marciej,

    Thanks for your fast response. I can confirm that i added a rewrite rule in a taxanomy of a custom post type as follows:

    add_action('init', function() {
        $product_labels = [
            'name' => 'Producten',
            'singular_name' => 'Product',
            'add_new' => 'Nieuwe product',
            'edit_item' => 'Product aanpassen'
        ];
        register_post_type( 'producten', [
            'labels' => $product_labels,
            'public' => true,
            'has_archive' => false,
            'menu_icon' => 'dashicons-media-document',
            'supports' => array( 'title','thumbnail' ),
        ]);
    
        register_taxonomy(  
            'kleur', 
            'producten',
            array(  
    			'hierarchical' => true,  
                'label' => 'Kleur',
                'query_var' => true,
            )  
        ); 
        
        register_taxonomy(  
            'merk', 
            'producten',
            array(  
    			'hierarchical' => true,  
                'label' => 'Merk',
                'query_var' => true,
            )  
        ); 
        
        register_taxonomy(  
            'soort', 
            'producten',
            array(  
    			'hierarchical' => true,  
                'label' => 'Soort vloer',
    			'query_var' => true,
    			'rewrite' => array('slug' => '/', 'with_front' => false),
            )  
        );  
    });

    When i do delete the rewrite rule the pages work again which is good. But i would like to keep my rewrite rule because i need it that way. And it works fine normally with pages but after installing and deactivating the plugin it doesnt any more.

    And furthermore when i do change it to something like:

        register_taxonomy(  
            'soort', 
            'producten',
            array(  
    			'hierarchical' => true,  
                'label' => 'Soort vloer',
                'query_var' => true, 
                'rewrite' => array('slug' => '/catalogus/', 'with_front' => false),
            )  
        );

    It still doesnt work. How can i send you the settings?

    Plugin Author Maciej Bis

    (@mbis)

    Hi @jefsev,

    could you try to use:
    'rewrite' => array('slug' => 'catalogus', 'with_front' => true),

    instead of:
    'rewrite' => array('slug' => '/catalogus/', 'with_front' => false),

    Unfortunately, it is not possible to use the same permalink format (without permalink/rewrite base) simultaneously for pages & custom taxonomy/post items. The rewrite rules must be unique for each content type. Otherwise WordPress will not be able to identify if post/page or term should be loaded.

    # Unique rewrite slugs/bases:
    https://example.com/about-us/contact [page URL will work]
    https://example.com/catalogus/sample-term [term URL will work]
    
    # Duplicated rewrite slugs/bases:
    https://example.com/about-us/contact [page URL will not work!]
    https://example.com/sample-term [term URL will work]

    My plugin allows to overcome this problem, because it does not rely on rewrite rules and instead checks if the exact URL is assigned as a custom permalink to any post/page/term.

    I explained it in a more detailed way here:
    https://permalinkmanager.pro/docs/tutorials/duplicate-wordpress-permalink-rewrite-base/

    Best regards,
    Maciej

    • This reply was modified 4 years, 9 months ago by Maciej Bis.
    • This reply was modified 4 years, 9 months ago by Maciej Bis.
    • This reply was modified 4 years, 9 months ago by Maciej Bis.
    Thread Starter jefsev

    (@jefsev)

    could you try to use:
    'rewrite' => array('slug' => 'catalogus', 'with_front' => true),

    instead of:
    'rewrite' => array('slug' => '/catalogus/', 'with_front' => false),

    This fixed it for me, but this ‘rewrite’ => array(‘slug’ => ”, ‘with_front’ => false), or ‘rewrite’ => array(‘slug’ => ‘/’, ‘with_front’ => false), still doesnt work. But that’s fine. Its solved for me, the above way is probably not the right way anyhow.

    Thanks for your fast support.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘All pages, old and newly create give 404 after plugin deativation’ is closed to new replies.