Only the temperature is changed.
*Only is the temperature is changed. (wrong)
Inversion of the type described by the Original Poster does not occur in main clauses when only is brought to the front of the main clause. This can be seen in example (2).
However, moving only to the front of a sentence can, and sometimes must, trigger subject auxiliary inversion in main clauses under the right conditions. Here are some examples:
- Only if we've received the papers can we release the prisoner.
- *Only if we've received the papers we can release the prisoner. (wrong)
- Only after the concert did I notice Pavarotti in the back row.
- *Only after the concert I saw Pavarotti in the back row. (wrong)
- Only in extreme circumstances did they steal.
- *Only in extreme circumstances they stole. (wrong)
- Only in the houses of parliament will you find this many cads.
- *Only in the houses of parliament you will find this many cads. (wrong)
These sentences have certain features in common. They all have adjuncts (read adverbials) in the form of Preposition Phrases. These Preposition Phrases all precede the main clauses. The head preposition in each case is being modified by only.
Only must have the sense of not except in such examples. Notice as well that if the adjunct is parenthetical in nature, then the inversion is not necessary. In the examples above, commas have not been used implying that the sentences are presented as one long integrated tune. In speech, if there is a pause, and the two phrases are said with discrete intonation patterns, then the non-inverted examples will usually be deemed grammatical:
- Only if we've received the papers mind - we can release the prisoner.
- Only in extreme circumstances - they stole.
Notice as well in the main examples that although only modifies the subordinate phrase, the inversion occurs in the main clause. The subject auxiliary inversion does not occur in the subordinate clauses.
One last point of note: this phenomenon is quite different from that of sentences with preposed negative adverbs. In sentences such as:
- Never have I seen such a debacle.
... the negative adverb fronts a main clause. Also, the adverb is not modifying the word it appears in front of. Importantly, the subject auxiliary inversion occurs in the same clause as the adverb. In contrast, in the examples with only, this adverb does not occur in front of the main clause. Secondly, the adverb modifies the head preposition in the Preposition Phrase. Lastly, only occurs in the same phrase as the subordinate clause, but the subject auxiliary inversion occurs in the main clause.
This also shows that inversion caused by only has nothing to do with sentences featuring not only ... but also. The not only ... but also construction is clearly a case of negative adverb preposing. It is the adverb not which causes the inversion in such sentences. This is easily demonstrated by the fact that the subject auxiliary inversion happens in the same clause that the adverb not occurs with:
- Not only did he laugh, he cackled.