• Help!!
    I created a custom taxonomy, it was working fine for a very long time but now I’ve been doing major modifications to my theme and suddenly the Meta Box in the post editor for the custom taxonomy (similar to the tags metabox) is no longer showing up. How would I debug something like this …it seems like such a difficult problem?

    Thanks in advance…

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hey Patrick,
    Look at the very top-right for SCREEN OPTIONS. Click and it will reveal some options you can check off at the top. Make sure Custom Fields is checked off.

    https://www.wpbeginner.com/glossary/screen-options/

    Hope that helps. If not, write us back.

    Thread Starter patrick_here

    (@patrick_here)

    Thanks very much but I found the problem….
    Originally my code that was calling the “register_taxonomy()” was linked to the “init” hook. But then I changed it and associated it with the “after_switch_theme” hook. That’s what broke it. So the fix was to change it back to using the “init” hook.

    If anyone can explain all this to me, I’d certainly appreciate it. Specifically, why can’t I use the “after_switch_theme” hook in a case like this? I thought that register_taxonomy() would simply register the new taxonomy one time (by an entry into the database) and that it would make sense to have that happen immediately after switching to the new theme. I even gave it a high priority number so that it would be the first of several functions to be triggered when I switch to the new theme …but that all didn’t help. Can anyone explain in clear language why the “init” hook is needed in this case and exactly WHEN the init hook is triggered and why my idea of calling register_taxonomy() immediately after switching to the new theme didn’t work?

    Thanks in advance for any help.

    Glad you found the culprit! With respect to your question about the int hook, I have no idea; perhaps someone else will weigh in soon to assist & school us both. Cheers!

    Moderator bcworkz

    (@bcworkz)

    “init” fires on every request, immediately after WP first becomes stable. Hooks before this can be unreliable, depending on what resources are used. after_switch_theme is self explanatory, what’s important is it does not fire on every request.

    What’s hard to understand (more as in belief, not so much grasp) is registering a taxonomy does not persist. It must be registered on every request. Even though the term data itself exists in the DB, PHP knows nothing of this unless a relationship is explicitly setup, which is what registration does. It’s truly amazing how much WP must setup on every request, very little is persistent. That modern servers can do all of this in a reasonable time has always impressed me.

    Thread Starter patrick_here

    (@patrick_here)

    Wow! Thanks so much for that explanation, bcworkz …that is a sufficient explanation and resolves it for me.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Debug: Metabox for custom taxonomy has disappeared’ is closed to new replies.