Shutdown your droplet and make a snapshot. Always remember to make a snapshot before you make any big changes.
Execute your wordpress docker image again.
$ docker ps
Remember the container ID to wordpress and execute
$ docker exec -it <container ID> vi <full path to the file with syntax error>
If you see this error:
exec: "vi": executable file not found in $PATH
$ docker exec -it <container ID> bash # apt-get update # apt-get install vim
After it finished without error, u can just edit the fill inside the container whatever you like.