WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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

For Posts you can have a preset category where all Posts fall if not specified otherwise (settings → writing).

Can this be done for custom post types that have a custom taxonomy?

The register_taxonomy does not seem to offer parameters for that.

Thanks again :)

share|improve this question
Hi any_h, please take a look at your questions, comment where it's necessary and mark stuff as solution that actually was/is one. – kaiser Sep 23 '12 at 10:44
up vote 2 down vote accepted

Try hooking into the save_post action to check the custom terms when a post gets saved:

add_action( 'save_post', 'set_default_category' );
function set_default_category( $post_id ) {

    // Get the terms
    $terms = wp_get_post_terms( $post_id, 'your_custom_taxonomy');

    // Only set default if no terms are set yet
    if (!$terms) {
        // Assign the default category
        $default_term = get_term_by('slug', 'your_term_slug', 'your_custom_taxonomy');
        $taxonomy = 'your_custom_taxonomy';
        wp_set_post_terms( $post_id, $default_term, $taxonomy );
share|improve this answer
Thanks I'll try that. – any_h Oct 5 '12 at 14:36

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.