These instructions are for self-hosted WordPress sites (WordPress.org). WordPress.com sites can not modified to use DuckDuckGo due to restrictions imposed by Automattic.

Install this plugin

This third-party plugin creates a widget to search your website through DuckDuckGo.

Create a DuckDuckGo search box

Customize the search box and then add the resulting code as a text widget.