Cut a small part of scotch tape.

Paste that scoth tape on the middle of the male plug.

USB uses 4 connectors, outside pins transmit current (+5V, 0V), inside pins transmits data (RX, TX).

Blocking inside pins will block data connection as shown on 2 last pictures (one uses the usb special cable, the other one not).

That hack is simple but it will charge device slowly. Data lines are used to negotiate power usage, see that article for further details :