• I’ve been using a hyphen for my custom post type namespace instead of an underscore, which I am seeing more widely used (my-posttype instead of my_posttype). Is there a technical reason why I should be using an underscore instead of a hyphen? Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Nope. It’s all only personal style. There’s o technical difference between the two. Most people seem to prefer the hyphen as it seems to look better to them, but that’s the only reason for it.

    Thread Starter working-together

    (@working-together)

    Thanks. From the themes I have looked at they seem to use the underscore more than the hyphen. I use the hyphen mainly because it saves me doing the rewrite setting for the slug, which I want it to be a hyphen.

    Underscores are not good for SEO. If you use underscores in your URL, Google will treat that as one word. Hyphens are treated as a separator between words.

    So, if you use my-post-title, Google reads that as “my post title”. If you use underscores, Google will read that as “myposttitle”.

    Here’s a video on the matter – https://www.youtube.com/watch?v=AQcSFsQyct8

    It also looks weird, yes.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘hyphen instead of underscore for post type’ is closed to new replies.