There are two sorts of restriction on speech: content-based restrictions and content-neutral restriction.
Content-neutral restrictions are “justified without reference to the content of the regulated speech.” Ward v. Rock Against Racism, 491 U.S. 781, 791 (1989). Content-based restrictions are everything else — they are justified with reference to the content of the regulated speech.
I earlier proposed the “Grumpy Cat Rule” for content-based restrictions: If the statute favors images of grumpy cats over other images, its regulation of speech is content-based.
That’s a narrow rule, applicable only to images, and it takes some processing to see its application to non-image speech. So here’s a broader test: The Seven Ws Test.
If the restriction of speech depends only on Where, When, or How, the restriction is content neutral. You can’t make sounds at more than 120 decibels after 10pm on Main Street: content neutral.
If the restriction depends in part on What or Why, the restriction is content based. You can’t play rock music at more than 120 decibels after 10pm on Main Street: content based. You can’t make sounds at more than 120 decibels after 10pm on Main Street to promote the Nazi Party: content based.
If the restriction on speech is otherwise content neutral, but depends in part on Whom (the subject or hearer of the speech), whether it is content based depends on whether the “whom” is the hearer (content neutral) or the subject (content based). You can’t continue to call someone who has told you to stop: content neutral. You can’t continue to talk about someone who has told you to stop: content based.
If the restriction on speech is otherwise content neutral, but depends in part on Who (the speaker) it is content neutral.1 Government employees cannot use Twitter: content neutral. Teachers cannot text students after school hours: content neutral.2
Note that “content neutral” is not “constitutional” and “content based” is not “unconstitutional.” Whether the statute is content neutral or content based affects only the level of scrutiny that applies; it’s harder to uphold content based restrictions.