Is one letter to short for $_GET? (used for a wordpress plugin)

I’m working on a wordpress theme-switching plugin that relies on the on a php $_GET, I want to keep the URL simple and clean. Is one letter to short? Example (‘t’): “foo.com/?t=theme_1″

What are the chances this conflicts with other stuff?

Read More

Of course this is somewhat subjective, and there is the obvious “p” that I should not attempt to use, but what is the best practice in this situation and in general?

Related posts

Leave a Reply

4 comments

  1. There is no specific problem with using one letter vars, but because you are using wordpress, you might want to be a bit carefull: not just for that p, but also for the future and/or other plugins

    I would advise that you use something quite unique in an environment you don’t have complete control over (updates etc.).

    Use a prefix for you vars, maybe 2 chars + ‘_’, or something like that.

  2. It depends on what your priorities are. I tend to only use $_GET if I specifically want the URL to be “hackable” to allow people to either directly link to the page or to allow them to navigate around if they’re paying attention. Because of this, I tend to use very clear $_GET variable names with easy to modify values, such as numbers. Ex:

    "foo.com/?theme=1"
    

    If you don’t especially need either capability, there’s no particular reason to use a $_GET at all – store the data somewhere else.