Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello.

    I wouldn’t recommend doing this, for various reasons, one of which is SEO.

    To make each word have a capital letter, you can try this however you’d have to customise that function to change the hyphens to underscores.

    Good luck!

    Thread Starter Mohsin Ali

    (@mohsinalimohsin)

    Hi @ashbodev, I’ve viewed stackoverflow link (but unfortunately that code is not working) and also know SEO factor but client is insisted to use that one.
    Anyway Thanks for quick response.

    Moderator bcworkz

    (@bcworkz)

    I don’t know if the SE suggestion of replicating most of the sanitation function is the best approach. I think I would simply patch up the resulting sanitized title through the same filter hook, by replacing the hyphens with spaces, running the string through ucfirst(), then replacing the spaces with underscores.

    Sure, it’s not efficient to lowercase something, only to uppercase it again. I suspect the performance hit is hardly measurable. I’d rather do that than take over a fair chunk of core code that will no longer be maintained by WP.

    Even when the title slug is properly transformed as desired, there’s still a possibility of having issues in other WP processes that are expecting a conventional all lowercase slug. Test thoroughly to be sure everything still works correctly.

    Worth pointing out that SEO article is from 2005. 13 years of work on the algorithm and I highly doubt it matters that much.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to create Capitalized_Urls in WordPress’ is closed to new replies.