3.4.1 case issue (8 posts)

  1. yolise
    Posted 4 years ago #

    I created a WordPress (3.4.0) site on my local server which worked fine. I transferred the theme files over to a new server with a fresh 3.4.1 install and one of the theme pages doesn't seem to be accessible via the lowercase slug - only when I use uppercase.

    This is easier to show than explain:

    This works: http://www.tnc-branding.com/wordpress/Clients/

    This does not: http://www.tnc-branding.com/wordpress/clients/

    The slug in wordpress is lowercase and worked fine on the old server before I updated to 3.4.1, but now is behaving on both servers (now running 3.4.1) incorrectly. Why can I only access this page when I change "clients" in the url to "Clients"? The lowercase is what's generated by wordpress so I can't just use the uppercase url.

    I have tried deactivating all plugins to no avail.

  2. Did you move from Windows to Linux? Cause Linux is case sensitive.

  3. yolise
    Posted 4 years ago #

    Maybe I should I explain again in a different way:

    I have a custom post type (this may or may not be relevent). The posts are called via a page called "clients" which has a lower-case slug - both in the custom post types and on the post itself: http://www.tnc-branding.com/wordpress/clients/. Every mention of it everywhere is lowercase. However, when I try to access the page, lowercase does not work. It only works when I call the page via the uppercase url: http://www.tnc-branding.com/wordpress/Clients/.

    Now, this page worked before I updated my installtion to 3.4.1. This has happened on two different servers.

    This is the custom post type:

    add_action( 'init', 'create_post_type' );
    function create_post_type() {
    	register_post_type( 'clients',
    			'labels' => array(
    				'name' => __( 'Clients' ),
    				'singular_name' => __( 'Client' )
    		'public' => true,
    		'has_archive' => true,
    		'rewrite' => array('slug' => 'clients'),
    		'hierarchical' => true,
    		'menu_position' => 5,
    		'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'page-attributes')

    This is the page code:

    			$args = array( 'post_type' => 'clients', 'posts_per_page' => 10, 'orderby' => 'menu_order', 'order' => 'ASC' );
    			$loop = new WP_Query( $args );
    			while ( $loop->have_posts() ) : $loop->the_post();
    			get_template_part( 'content', 'clients' );

    Can anyone see why this would work in 3.4.0, but not in 3.4.1?

  4. fonglh
    Posted 4 years ago #

    Have you tried refreshing the permalinks by visiting the Settings -> Permalinks page?

  5. yolise
    Posted 4 years ago #

    Yes, I've tried that a couple of times, actually.

  6. yolise
    Posted 4 years ago #

    OK, I may have found a solution, however, I'm not sure what has changed or why. Actually, a reason for the behaviour rather than a solution, sadly.

    In the functions file, I've changed the slug from "clients" to "clientpages" and it works. It seems that it has a problem with the slug that's defined in the post-type function having the same name as a page where it didn't in previous versions of WordPress. This is unfortunate as I've used this structure before to create pages like:

    http://lisadearaujo.com/clientaccess/TNC/wordpress/clients/ for the main client index and
    http://lisadearaujo.com/clientaccess/TNC/wordpress/clients/companya/ for the individual client listing.

    Changing it means messing with some of my other customer's SEO and links in, so I am going to either have to create HTaccess rewrite rules or simply not update their installations unless someone has another solution to this?

    So, not really resolved, actually... at least not for any of my established sites.

  7. It seems that it has a problem with the slug that's defined in the post-type function having the same name as a page where it didn't in previous versions of WordPress.

    Given that WP doesn't come with a page 'clients' what happened here is someone made a page with the same name as your CPT slug. Yeah, that'd do it.

    I'd delete the Clients page.

  8. yolise
    Posted 4 years ago #

    Given that WP doesn't come with a "clients" post type, what happened here is that someone made a post type with the same slug name as the page.

    As you can see from above, it was intentional, and only a change to 3.4.1 made this not work.

    As it happens, I've come up with my own workaround (which admitedly is probably how I should have done it in the first place, but when one technique works, one doesn't usually keep rooting around for a new solution - it's not really cost-effective).

    It also means I have to re-engineer more than one theme that I've written.

Topic Closed

This topic has been closed to new replies.

About this Topic