Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am testing a Wordpress theme using the Wordpress Theme Unit Test test data. One of the test posts has no title. Wordpress generates a permalink of the form:

<my-site>/posts/14/

(my permalink structure is "/posts/%postname%/").

The Wordpress recommendation is "Post permalink should be displayed. Making the post date a permalink is a great solution."

That's exactly what I did. Unfortunately, when I click on the link:

  • I do not get the post in question. The page I do get appears to be the similar to the paged index of all posts, except that all non-paged posts are displayed in full, instead of as excerpts.
  • The page navigation is incorrect. The link for older posts is "/posts/14/page/2/", which causes the same page to be redisplayed.

If I change the post slug to "post14", it works just fine, so the problem is evidently due to the numeric slug.

Obviously I could change the slug, but that's not a real solution. Once the theme gets out in the real world, I can't guarantee that users will always use post titles or that they'll know enough to change the slug.

Any suggestions?

share|improve this question
    
your pages are being saved without title? I thought that is a requirement for pages for being saved... are you using WP Multisite? I noticed in certain installations permalink structure can be messed up while setting things up, you should check the permalink structure also in the WP network –  nekojira Feb 26 '12 at 10:35
1  
The post has no title. I would not have thought of doing that, but it is one of the test posts provided by the Wordpress team for testing themes, and they have recommendations for how to handle such situations. So apparently it is something a theme should accommodate. This is not a Multisite, and the permalink structure seems fine. –  Bob Dye Feb 27 '12 at 16:08
    
I'm not sure if I understood what you need to do, sorry. If you want the post to show no title in the frontend why you just don't remove functions like "the_title()" or other calls in the wordpress loop that display the post title in the final html? in that way it won't be displayed in your page as seen in the frontend - is it really a problem if you assign your post or page a title in the backend? –  nekojira Feb 28 '12 at 16:59
    
Oddly enough, I messed around a bit with my WordPress installation on localhost and live, I have the same problem, but only when the permalinks are set to /%postname%, they work fine with /%category%/%postname. –  Jared Mar 2 '12 at 21:22

1 Answer 1

TL;DR: go the the edit post screen, clear the Post permalink/slug (found immediately below the Post Title field) by clicking "Edit", and then deleting the existing text, and save.

So, what's happening here:

On the site where the Theme Unit Test data are hosted, the ID of the post in question is 14. When you import the data, the ID of that post may or may not be the same.

With posts with no Title, WordPress generates a permalink slug based on the posts' ID. So in the original site, WordPress generated a permalink slug using the ID "14". When you import the data, that permalink slug is retained, even though the post's ID may change. Ergo, you get a broken permalink.

For reference, see this still-open Trac ticket related to numeric post titles: http://core.trac.wordpress.org/ticket/5305

share|improve this answer
    
Thanks for the suggestion. You were right; the ID was incorrect, and taking your approach fixed that. Unfortunately, the Permalink for the post still does work. Using that link simply displays the list of post, starting with the latest post. –  Bob Dye Mar 8 '12 at 16:07
    
Did you flush/reset your permalink rewrite rules, by going to Dashboard -> Settings -> Permalinks, resetting to default, saving, then changing back to your desired permalink structure, and saving again? –  Chip Bennett Mar 8 '12 at 16:09
    
No, I hadn't. I had not heard of that one before. Unfortunately, doing that (several times and in several ways) didn't change the result. –  Bob Dye Mar 9 '12 at 17:16
    
If you use the default permalink structure (i.e. no rewriting), does the permalink work? –  Chip Bennett Mar 9 '12 at 17:18
    
Yes, it works with the default permalink structure. –  Bob Dye Mar 11 '12 at 18:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.