I’m working on a boilerplate for custom post types and custom taxonomies and I’ve run into a dilemma. I like the organization of having each of my custom post types in their own included php file, but since I’d have an add_action('init', 'POSTTYPE_NAME_register', 0);
in each of those, would there be a significant performance hit from having multiple hooks in init
as opposed to consolidating them into a single function?
Leave a Reply
You must be logged in to post a comment.
No. The biggest slowdown in your scheme would be the accessing of the multiple files. Unless you’re loading 1000s of included files this way, it’s probably not an issue. If you have a reason to have each CPT in it’s own file, do it.
I’d agree that this would not be a performance problem. But even so, you might consider doing it this way from within the theme’s function file, just to keep things all in one place. Of course, this is assuming that your CPT’s are tied in with the theme. If they are tied in with a plugin, then forget this answer completely.