During editing, sometimes new user posts a part of code in the title, which is weird. Is it okay to change it based our understanding of user's question?

I know editing allows us to change the title but I'm in doubt whether that is the right thing to do because it is like asking a new question even though it is not.

  • I think, until 1) you make the post better 2) don't change the intent of the OP, anything is okay. These criterias aren't so clear, so you will have now some longer, official answers detailing them. – peterh - Reinstate Monica Mar 20 '17 at 4:57
  • I am sad that I don't have 2k here, I would be so happy to change the first letter of your question title to capital case :-) Simply because it looks so better. :-) – peterh - Reinstate Monica Mar 20 '17 at 4:58

In most cases, the title is the most important edit you can perform. This is what shows on lists of questions, whether that's the home page, the tag page, related questions down the side, possible dupes, or many other places. Yet most users (even experienced ones) choose horrible titles.

A good title:

  • is an actual question, often starting "how do I" or "why does"
  • does not contain any markup
  • does not contain words like question, problem issue, broken, not working, or the like
  • does not contain tags
  • summarizes the issue the user is facing (read the whole body to gain this understanding, then share it with others by editing the title.)

So for example on Travel, a question might have the title "Family trip to Greece" but when you read the body, it's clear they are asking about ID requirements at hotels, or transit visas, or permission letter from one parent to let the other parent take a child out of the country. So you edit the title to make it clear what the question is about.

On code-oriented sites, if the user has mentioned an error number, a short error message, or a keyword, it's probably a good idea to have them in the title. "Why am I getting C2202 when I know I declared the function?" is better than "Complier is lying that something is mssing that is NOT MISSING" even if the latter better captures the emotional state of the user. [I made up the error number, please don't judge me, also "typos" in bad title are deliberate.]

It's my observation that people who are bad at writing titles in the Stack Exchange "style" are also generally bad at tags, so check those while you're doing the edit. Writing a great title is hard. Improving a bad title, even if you don't get all the way to great, is worth it.

If you have read the question carefully and can't figure out a good title, that is a strong clue that you can't figure out what the question is or how to answer it. If you can flag or vote to close as "unclear what you're asking" this would be a great time to do so. Consider also leaving a comment asking for the details or clarity that are missing.

  • 1
    Note: most users are bad not just at SE titles, but email subjects, newsletter headers, and on and on. Titles is hard. – Nathan Tuggy Mar 20 '17 at 22:31
  • while I agree with this answer, but as @NathanTuggy said, summarize the user's issue with only a few words is hard. – whale_steward Mar 21 '17 at 16:08

Titles are a reference label, a brief description of the question so it can be found by later searches; they do not form the whole question, or even a relevant part of it.

Remove any code and edit the title to briefly describe the problem. For example, instead of a title like

Getting error goto{a}&kvar(t==t+1) sets kvar(t=t) why my code breaks help plz

change it to say something like

Rattlesnake 7.1's "goto" linked with variable change makes variable reset to wrong value: what could cause this error?

Yes, that's obviously nonsense code as written, but especially with an esoteric language, the syntax may make perfect sense in the context it was used.

However, the only way to make the context known is the body of the question providing details about what is intended, what is desired output, and what else the e.g. kvar would be involved with. Having the code in the title doesn't help any of these things, and interferes with other things (screenreaders, formatting), so at best it's a harmless nuisance of no aid, and at worse makes Stack Exchange an unwelcome place to be.


From your question, you want to remove part of code from the title.

There are many situations.

May be the OP tried some code and highlighted the major keyword/function used, in title.

For example,

syntax produce error or something.

In such case if you edit it to

getting error

or something, it is very bad because, for the first title, it will be helpful to people to understand the error from home page itself without opening question.

In such cases, the title should not be changed.

Sometimes, new users post lines of code to title which is weird as you said.

It should be either removed completely or should be shortened.

Note that title is the key to a question and many people open the question by looking the title and tags.

So editing tags and title should be done carefully and if you are in confusion, feel free to ask more details as comments to the question

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .