• I have gone to many examples and trials but I cannot manage to register a custom post type on button click. My code is fine when registering the post because I ran it in my functions.php on init hook and it worked ok.

    My problem is that I don’t understand how to call the register function on a button click. My goal is to create a personal plugin, and on click a custom post type is created with the given name.

    In the codex it says:

    Note that you must call register_post_type() before the admin_menu and after the after_setup_theme action hooks. A good hook to use is the init hook.

    Does this mean that such function is only called by using add_action, and not at anytime I like?

The topic ‘Call register_post_type on click’ is closed to new replies.