The simpler case myOp[c^2 h2[x, t]] has a similar problem using your current definitions:
myOp[c^2 h2[x, t]]
h2[x, t] myOp[c^2]
If you look at the FullForm of c^2, you will notice it expressed as Power[c, 2]. This means that the expression myOp[c^2 h2[x, t] really corresponds to myOp[Times[Power[c, 2], h2[x, t]]]. This matches your second definition of myOp, but between the Power and h2 expressions, which should be assigned to a, and which should be assigned to h in your definition pattern? The "wrong" choice of assignments is what leads to your unwanted result.
Instead, you may want to consider any expression with a built-in head (such as Power) as "constants" in your definition. You can filter those out by the context in which those symbols reside. In fact, built-in functions reside in the System` context, whereas most of your user-defined ones will reside e.g. in the Global` context.
Following Mr. Wizard's lead from a previous question, we can implement a helper function to distinguish them in your definition:
ClearAll[isBuiltIn]
isBuiltIn[s_] := Context[Evaluate@Head@s] === "System`"
For instance: isBuiltIn[c^2] returns True.
So now we modify your definitions:
ClearAll[myOp]
myOp[Plus[f_, g_]] := myOp[f] + myOp[g]
myOp[a_?isBuiltIn f_[x_, t_]] := a myOp[f[x, t]]
and try this out:
myOp[c^2 h2[x, t]]
c^2 myOp[h2[x, t]]
and for your original case:
myOp[c h1[x, t] + c^2 h2[x, t]]
c myOp[h1[x, t]] + c^2 myOp[h2[x, t]]
Don a function),myOp[D[u0[x,t]+c u1[x,t]+c^2 u2[x,t],x]], it gives a looking-correct answer with a warning >Context::ssle: "Symbol, string, or HoldPattern[symbol] expected at position 1 in Context[...]" Any idea? – lxy Mar 22 '19 at 02:12myOp[c h1[x, t] h2[x, t]]? I expectc myOp[h1[x, t] h2[x, t]]but it givesc h2[x, t] myOp[h1[x, t]]. – Rodion Stepanov Apr 12 '23 at 12:09