Applies to: SharePoint Server/on-prem
I love SharePoint’s Content Query Web Part (CQWP) – but if you’re missing a feature in your site collection(s), you may not have it! Luckily you can get it back in just four clicks.

- Go to Site Settings

- Click “Site Collection Features” under “Site Collection Administration” (Note: Must have full control or site collection administrator permissions to see this option)

- Activate “SharePoint Server Publishing Infrastructure“

- Now your CQWP should be available as a web part under Content Rollup.

If you need to activate the SharePoint Server Publishing Infrastructure across all site collections in a web app, I recommend checking out
Salaudeen Rajack’s site, SharePointDiary.com, for instructions on doing this via PowerShell.