Is there a way to mimic the 'inherit rotation' of a bone? I need a child bone to 'inherit rotation' but in limited fashion.
I just need it to inherit the rotation of its parent when:

it turns left and right.
So if the knee turn in certain angle, the foot will follow.
But if the knee goes up and down, the foot need to stay unaffected

If I tick off the 'inherit rotation'. It fullfil the second requirement, but not the first.
If I tick off the 'inherit rotation'. It fullfil the first requirement, but not the second

Copy rotation constraint doesn't work, because the parent bone is straight up, while the child is 45 degree shifted.
Locked track doesn't work, because the child can only rotate in its local coordinate.
Transformation constraint doesn't work either.
I need to use the rig as is, meaning I can't change the foot bone orientation origin to as the same as the knee bone. Due to a certain condition.
Any ideas?
I'm assuming this is an IK chain, because if not the foot will always follow the knee rotation. In IK chains generally this behaviour is obtained by making the knee pole target child of the foot, so that you rotate the foot and the knee rot follows (while you're trying to do the inverse).
If you really need this inversion you can create a bone in the loc of the knee with the same orientation of the foot bone; make it child of the knee bone; set a copy rot constraints on the foot bone following only the rot axis needed (in my example Z axis).