WordPress pages (as opposed to posts) do not have pingback and trackback support by default. I had a need to enable it here in order to allow certain pages to accept incoming Webmentions. In that case, I added the PHP snippet to my child theme’s functions.php file. But with multiple sites and the possibility that I may not always use the same theme, I decided to convert the snippet into a site-specific plugin. The code is available in my personal Gitea repository. Feel free to use and extend (instructions for extending are in the code comments).
(Syndicated with mild modifications from The Emu Café Social.)