Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter MaxMcNally

    (@maxmcnally)

    I managed to get it to work by adding a filter instead of an action –

    add_filter('wp_insert_post_data','create_taxonomy_callback');

    and here is my callback function –

    if($data['post_type'] == 'revision' || $data['post_status'] == 'auto-draft') {
    			//Ignore revisions
    			return $data;
    		}
    
    		if($data['post_type'] == 'villagelife' && !term_exists( $data['post_title'], 'villagelife' )){
    			wp_insert_term(
    			$data['post_title'], // the term
    				  'village' // the taxonomy
    			);
    		}

    Hope that helps!

Viewing 1 replies (of 1 total)