Make WordPress Core

Opened 9 years ago

Last modified 5 years ago

#36746 new defect (bug)

WP v4.5.1 broke something in the Permalinks settings

Reported by: voidportal's profile voidPortal Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.5.1
Component: Permalinks Keywords:
Focuses: Cc:

Description

WP v4.5.1 broke something in the Permalinks settings. The Plain Permalink settings do work, though:

http://domain/?p=123

One weird thing I saw just now while I was trying different Permalink settings is that several times the word "blog" appeared in all the Common Settings example URLs when it never had before. For instance:

http://domain/blog/2016/05/04/sample-post/

But it is no longer there now. Now that Day and name common setting shows as:

http://domain/2016/05/04/sample-post/

Change History (7)

#1 @fregan
9 years ago

  • Severity changed from normal to major

I am also experiencing the same issue. When upgrading to 4.5.1 every page on my site but the homepage results in a 404. When i rollback changes locally in GIT, the permalinks work just fine - so this tells me it is the 4.5.1 update.

The example voidPoprtal provided above with "blog" is just how wwe have our permalinks setup.

The custom permalinks for our site are setup as:

/blog/%postname%/

We were able to recover and get the permalinks working correctly by setting it to Post Name - but this is very detrimental to SEO.


================ UPDATED ======================

Someone had edited a custuom post type plugin with flush_rewrite_rules(); - commented this out, re-saved permalinks and it is now working correctly. Here is the code that was causing errors:

<?php
/**
 * Create post type
 */
add_action('init', 'create_project');
function create_project() {
  register_post_type('project',
    array(
      'labels' => array(
        'name' => 'Projects',
        'singular_name' => 'Project',
        'add_new' => 'Add New',
        'add_new_item' => 'Add New Project',
        'edit' => 'Edit',
        'edit_item' => 'Edit Project',
        'new_item' => 'New Project',
        'view' => 'View',
        'view_item' => 'View Project',
        'search_items' => 'Search Projects',
        'not_found' => 'No Projects found',
        'not_found_in_trash' => 'No Projects found in Trash',
      ),
      'rewrite' => array(
        'slug' => 'our-work/projects',
        'with_front' => FALSE,
      ),
      'public' => TRUE,
      'menu_position' => 6,
      'menu_icon' => 'dashicons-flag',
      'supports' => array('title', 'editor', 'thumbnail', 'page-attributes'),
      'taxonomies' => array( 'snwks_project_type' )
    )
  );
  // Press Taxonomies
        $projcats = array(
                'name'            => 'Project Categories',
                'singular_name'   => 'Project Category',
                'search_items'    => 'Search Project Categories',
                'all_items'       => 'All Project Categories',
                'edit_item'       => 'Edit Project Category',
                'update_item'     => 'Update Project Category',
                'add_new_item'    => 'Add New Project Category',
                'new_item_name'   => 'New Project Category',
                'menu_name'       => 'Project Categories'
        );
        // register categories
        register_taxonomy( 'snwks_project_type', 'project', array(
                'labels'              => $projcats,
                'hierarchical'        => false,
                'public'              => true,
                'show_ui'             => true,
                'show_admin_column'   => true,
                'show_in_nav_menus'   => true,
                'show_tagcloud'       => true,
                'query_var'           => true,
        ));
  //flush_rewrite_rules();
}
Last edited 9 years ago by fregan (previous) (diff)

This ticket was mentioned in Slack in #core by fregan. View the logs.


9 years ago

#3 @fregan
9 years ago

Upgrading from 4.4.2 to 4.5.1 and getting this issue FYI

Version 0, edited 9 years ago by fregan (next)

#4 @fregan
9 years ago

  • Severity changed from major to normal

#5 @voidPortal
8 years ago

I've updated to WP v4.5.2, and this issue still is occurring.

#6 @lukecavanagh
8 years ago

So a couple of questions, what is the active theme. How is the custom post type code set is it in a site specific plugin or is it within a inc folder or the functions.php of the active theme?

Also does the issue still happen if you change the site to a default theme?

Last edited 8 years ago by lukecavanagh (previous) (diff)

#7 @voidPortal
8 years ago

The active theme is Songwriter (now 2.0.4), but this issue was happening with all themes I tried.

And I am not specifically using a custom post type.

If you were asking about the custom structure for my permalinks, if I tried to set the Permalinks to "Day and name" instead of "Plain" (which is the only one that still worked after upgrading to WordPress 4.5.1 and then 4.5.2), the structure is the out-of-the-box:

http://[domain]/%year%/%monthnum%/%day%/%postname%/

I just fixed the problem by adding this to my .htaccess file:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

I never had to do that before upgrading to WordPress 4.5.1, however, so this is still puzzling to me.

And I have another WordPress site where upgrading to 4.5.1 did NOT break the permalinks.

The one where the permalinks did break has had posts posted every day since the beginning of this year and their category is identical. It is also a multisite WordPress, but then again so it my other site (a different multisite WP) where the permalinks never broke.

Last edited 8 years ago by voidPortal (previous) (diff)
Note: See TracTickets for help on using tickets.