Here's a simple environment in which the OP's original code works:
Block[{Times, Hold, attr = Attributes@Times}, SetAttributes[Times, attr]; Hold[(\[DifferentialD](-A \[Omega] Cos[\[Theta][x, t]]) \[DifferentialD]\[Theta])/(\[DifferentialD]\[Theta]\ \[DifferentialD]t)] /. \[DifferentialD](-A \[Omega] Cos[\[Theta][x, t]])/\[DifferentialD]\[Theta] -> k ] (* Hold[(k \[DifferentialD]\[Theta])/\[DifferentialD]t] *)
In the above we don't need to worry about how the Front End and MakeExpression[] parsed the user's input. If the held expression had been generated by code, then the full-form would almost certainly be different than what you get by pasting the OP's sample code into Mma. Then we might have to inspect the result and construct another replacement pattern. How the expression was typed may result also in a different expression-tree. While equivalent algebraically, different trees probably need different patterns. That does not seem to be the case in the environment above.
Here's an alternate test case:
Hold[\[DifferentialD]\[Theta] (\[DifferentialD](-A \[Omega] Cos[\ \[Theta][x, t]]) )/(\[DifferentialD]\[Theta] \[DifferentialD]t)] /. \ \[DifferentialD](-A \[Omega] Cos[\[Theta][x, t]])/\[DifferentialD]\[Theta] -> k
The OP's target use-cases are unclear. If a somewhat safer environment is needed in which the OP's variables are not evaluated, here's a trick I picked up from Leonid Shifrin or Mr. Wizard or someone, oh, maybe a dozen years ago:
withHeldSymbolsIn // ClearAll; withHeldSymbolsIn // Attributes = {HoldAll}; withHeldSymbolsIn[expr_, code_, contexts_ : {"Global`"}] := Thread[ DeleteDuplicates@ Cases[Hold[expr] , s_Symbol /; MemberQ[contexts, Context@Unevaluated@s] :> Hold[s] , Infinity] , Hold] /. Hold[v_] :> Block[v, code]; expr = Hold[(\[DifferentialD](-A \[Omega] Cos[\[Theta][x, t]]) \[DifferentialD]\[Theta])/(\[DifferentialD]\[Theta]\ \[DifferentialD]t)]; withHeldSymbolsIn[Evaluate@expr, Block[{Times, Hold, attr = Attributes@Times}, SetAttributes[Times, attr]; expr /. \[DifferentialD](-A \[Omega] Cos[\[Theta][x, t]])/\[DifferentialD]\[Theta] -> k ] ] (* Hold[(k \[DifferentialD]\[Theta])/\[DifferentialD]t] *)
Note that while the attributes of Times[] are restored inside the environment, like factors do not cancel or combine although arguments are sorted and the nested Times[] instances are flattened:
Block[{Times, Hold, attr = Attributes@Times}, SetAttributes[Times, attr]; expr ] // FullForm (* Hold[ Times[ Power[DifferentialD[t], -1], Power[DifferentialD[\[Theta]], -1], DifferentialD[\[Theta]], DifferentialD[Times[-1, A, \[Omega], Cos[\[Theta][x, t]]]] ]] *)
Times[]insideHold[]are not flattened becauseTimes[]is not evaluated. The two expressions as posted have a non-matching structure. I suppose you're trying to keep the $d\theta$s from canceling. Algebraic manipulation by replacement rules is tricky, especially if you don't allow algebraic evaluation to occur. $\endgroup$First@SolveValues[{z == (\[DifferentialD](-A \[Omega] Cos[\[Theta][x, t]]) \[DifferentialD]\[Theta])/(\[DifferentialD]\[Theta] \[DifferentialD]t), \[DifferentialD](-A \[Omega] Cos[\[Theta][x, t]])/ \[DifferentialD] \[Theta] == k}, z, {Cos[\[Theta][x, t]]}]— I'm wondering what you're actually wanting to do. Your question seems very specific, and a very specific solution might apply to a very narrow type of problem and be of little help. If it is this narrow, then I can type the answer faster than I can code the solution. $\endgroup$