Sometimes the PS4 controller will not hold charge or will not charge at all. This occurs from time to time depending on the controllers usage and battery charging frequency.
If your controller will not hold a charge (even if it shows it's charging) it likely means the battery needs to be depleted fully until recharged. To do this, use the controller as much as you can until the controller will no longer turn on. Once this happens, you can then try charging it. This time let it charge until it has full battery and it should now maintain the charge.
Let us know if this doesn't work for you in the comments below. This should work!