can register_post_type() be safely called before init

The short answer is no. For the canonical example of why just take a look at native post types. They are registered twice during each page load:

  1. Quite early because of backwards compatibility reasons and plugins possibly expecting them to exist.
  2. On init because now locale things are actually loaded and post type definitions can be properly translated.

So long answer is — you can make it work, but you are in a world of pain and poor performance to make it happen properly. Just don’t. 🙂

Leave a Comment