WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Say a plugin creates a custom taxonomy and attaches it to some custom post type. Is there a safe way to attach that same taxonomy to Posts?

share|improve this question

You can use register_taxonomy_for_object_type function and if you say that the taxonomy is created by a plugin you can use the plugins_loaded hook, to make sure that taxonomy wast already registered so:


function add_custom_taxonomy_to_posts(){
    register_taxonomy_for_object_type('TAXONOMY_NAME', 'post');
share|improve this answer
While this is correct WordPress dictates you should register Custom Post Types & Taxonomies on the init hook IIRC. – Cristian Jul 9 '11 at 12:04
accept you can't be sure when the taxonomy is registered, so you call it after the plugins are loaded – Bainternet Jul 9 '11 at 12:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.