Viewing 14 replies - 46 through 59 (of 59 total)
  • You stated above about your “solution”:

    it breaks on subsequent pages of the category archive

    In my books that means – it doesn’t work.

    Uh, didn’t you read the next sentence, where I explained how I fixed the category archive? I said it was a “hack solution”, but it does (most of) what I want it to. YMMV.

    Can we just end this discussion?
    Use your hack if it makes you happy.
    Most of the bloggers (WP users) don’t care about it, so they don’t need it.
    Being an open source script everybody is welcome to hack, modify the code as they want.

    However, I hope that a “feature” requested by only a tiny (but stubborn) minority will not get into the core of WP.

    Unless somebody has something productive to add – this thread should stop here!

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    Thanks for the explanation. I can see that it makes sense from an efficiency point of view. However the curious thing as I pointed out previously is that in the situation where you have permalink structure /%category%/%postname%/, then the “clean” category link of the kind I desire, ie yourblog/foo/, automatically works already.

    So presumably in that case WP already knows to perform the extra queries you describe?

    No. The system is a fallback mechanism, you’re abusing it by not specifying the full path.

    Basically, it turns segments of the URL into query variables internally, through the rewrite mechanism. So when you give it /category/whatever, it sees that and sets the ‘category_name’ variable to ‘whatever’. It does this with lots of different things according to its rule set. So if it sees /author/bob then the ‘author’ variable gets set to ‘bob’.

    In your case, you used the last check, which is the custom permalink string, only you gave it a blank postname. So the postname is blank, which equates to empty, which means that it has no postname set as far as it’s concerned. But the category was set, so there you go.

    Eventually, once it has parsed the URL, it looks at the variables and works out what the most specific thing that it can retrieve is. If you gave it a postname, it could narrow it down to one post. Since you gave it a blank postname, it thinks that it doesn’t have one (a blank string is considered “empty” in PHP), and sees only the category_name that’s set. Thus you get a category archive.

    The reason “pages” don’t work is because when you do /categoryname/page/2, then you’re setting the postname to ‘page’ and that doesn’t match anything in the database. Your matching rules don’t work because you’re abusing them in that manner. You’re not just telling it that the category = whatever, you’re also telling it a blank postname, which just happens to allow the code to consider it “empty”.

    It’s not doing any extra database work. It knows that you want a category archive because the category is set and the postname is blank.

    Also, it knows that it’s not a Page in your case because Pages are special. They get saved as an array of Pagenames and each one has its own special rewrite rule.

    Uh, but my matching rules do work. Check my site’s “articles” tab if you don’t believe it.

    Moshu: you may not care about this yourself but the hundreds of comments on pages announcing the various plugins that try to offer this capability (which unfortunately don’t work) indicates that actually quite a lot of WP users would like it.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    Uh, but my matching rules do work. Check my site’s “articles” tab if you don’t believe it.

    If you consider https://stevenpoole.net/articles/page/2/ giving me a redirect to https://stevenpoole.net/section/articles/page/2/ as “working”, then sure. Seems a bit inconsistent to me, and a long way to go to just get rid of “section” on the first category page URL. Did you also notice that the before and after links on the resulting page use “section” as well? Seems like a halfway solution, at best.

    In other words, I have read your posts and looked at your site. And I know exactly why your site is behaving the way it does. I know exactly how the rewrite system works. You, clearly, do not. I tried to explain to you above why it’s not as easy as you think, but you missed the explanation, or didn’t understand it. Could be my fault, it is a complex system. Needless to say, it does not work the way you think it does or want it to do, and it would not be as simple as you think it would be to do what you want it to do. I admit that your little hack is interesting, but ultimately inconsistent within the site and the whole thing just seems somewhat pointless.

    indicates that actually quite a lot of WP users would like it.

    Again, I’m forced to ask: Why? Why, why, why? What’s *the point*? It helps not in the slightest. It doesn’t look that much cleaner. In fact, your attempt looks fairly dirty at best. What’s more, you could have totally faked it with actual Pages much more simply and without needing extra .htaccess rules. So I ask you, why is this such a big deal?

    99% of the people I see asking for it on these forums get it explained to them that it’s “really hard” and are satisfied with that. So, at best, it’s a passing fancy, and a fairly useless one at that.

    No, I got your explanation, and I thank you for it. I entirely agree that my redirect is “a halfway solution at best”. For me that’s better than no solution.

    The problem really boils down to your hostile attitude. You say I’m abusing WordPress by trying to make it do what I want; and you keep insisting that this thing, that many other users also want, is a stupid thing to want.

    If WP developers don’t want to implement this feature, that’s an entirely reasonable decision in my opinion and I’m not going to cry about it. Just don’t try to tell the users they’re idiots for wanting it.

    BTW I did get as far as figuring out how to wrap a category archive in a Page, but though that would make the per-category paging nicer, it still wouldn’t be a fully consistent solution sitewide either, as the category links generated from the_meta would still point to the regular category archives. Oh well. ??

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    I’m really not trying to be hostile. Sorry if it’s coming across that way. ??

    But yeah, I do think it’s a pretty stupid thing to want. ??

    Lol, well ok I guess we’ll have to agree to disagree. ??

    Properly structured URLs should be hackable, for example:

    https://domain.com/category-name/subcategory-name/post-title/page2
    https://domain.com/category-name/subcategory-name/post-title
    https://domain.com/category-name/subcategory-name
    https://domain.com/category-name
    https://domain.com/

    It’s a simple matter of logic.

    This is the way that most, if not all other CMS permalink structures behave.

    It doesn’t necessarily help with SEO, but it does help massively with usability. With WordPress as it stands, if you remove post-title from the following URL, you hit a 404:

    https://domain.com/category-name/post-title

    This is not the expected behaviour, therefore it should change.

    Relevant articles on the benefits of URL-hacking:

    https://jerz.setonhill.edu/writing/e-text/url-hacking.htm
    https://www.useit.com/alertbox/990321.html
    https://blog.paramagnus.com/archive/2007/03/20/467.aspx
    https://simonwillison.net/2003/Jul/30/newsSiteURLs/

    It’s not a new concept by any stretch.

    [Moderated: Post released from Askimet Spam Filter]

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    This is not the expected behaviour, therefore it should change.

    Why would that not be the expected behavior?

    If it were up to me, I’d remove the category name from the custom permalink structure anyway, because the idea doesn’t make any sense. A post is not in one and only one category, it can be in multiple categories. Therefore the notion of having a permalink (of which there is supposed to be one and only one) using a category name within it is flawed to begin with. You wouldn’t put %tag% in the permalink, neither should you ever put %category% in it.

    In other words, conceptually, the post is not “inside” the category. The category is attached to the post. Your URL implies a structure that is false-to-fact.

    I have noticed that people have the same sort of problem getting their minds around GMail and the concept of “labels”. If you’re used to some email client, you have the idea of mail going inside folders. While you can indeed use GMail’s labels that way, there’s a difference in that multiple labels can attach to the same emails. So your email can go into multiple folders, sorta. WordPress’s Categories and Posts are the same way, and some people just can’t seem to get to grips with that concept. In fact, from an architectural point of view, there is no real difference between categories and tags, except the name.

    neither should you ever put %category% in it.

    Here you go again! Some users want to organize their sites that way, and it makes perfect sense for some collections of content to be organized in exactly that way. If you don’t understand it, fine; if you say well WordPress wasn’t really designed to act that way, fine too; but don’t try to tell users how they must build their sites as though they’re wrong to have that preference.

    Otto42 you seem to be under the impression that your opinion is of more weight than other people’s, or even the general consensus. I disagree. I have conducted many usability tests with many candidates and these tests have shown that what I have stated above, is not the expected behavior.

    A post belonging to a category should have the category in the URL all the while it belongs to only one category. It creates a logical folder-like structure.

    My ideal outcome would be for WordPress to allow the proper use of %category% in the permalink, when I have made a conscious decision to use WordPress as a CMS, and set myself and other site users a rule to only place posts within one category. Multiple categories is an excellent function but mostly used for blogs. Poeple don’t always use WordPress as a blog, and that’s half of its appeal to me.

Viewing 14 replies - 46 through 59 (of 59 total)
  • The topic ‘how could i remove word “category” from urls?’ is closed to new replies.