I have a custom page template, so a .php
file in my themes folder with this at the beginning
/*
* Template Name: MyTemplate
*/
Now I can, in the WP backend, create new pages and select this template so that the page created uses this template.
How can I limit the number of pages using this template? For example, if I only want to allow one single page using this template? Or if there's only ever allowed three pages that may use it. How can I achieve this?