How to deal with D+ and D- on the end of a device that will be charged only?
In the answer you linked, the DP/DM termination is shown for the ‘host’ (downstream facing) port, be it a regular USB or a power-only port. This termination is how an endpoint can determine the host’s charging viability without having to enumerate as a USB device: the ’device’ (upstream facing) port senses the terminator and limits its current draw accordingly. The exact details of this are a bit of a mess - there’s the USB way, the Apple way, the Sony way, etc.

Fortunately, for a simple power connection you don’t have to do anything in the endpoint. Just leave the DP/DM pins open. The host’s current limiting will kick in if your device exceeds what the downstream-facing port can deliver.

More here: https://www.maximintegrated.com/en/design/technical-documents/tutorials/5/5801.html