Created
August 21, 2010 17:20
-
-
Save sproutventure/542588 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Creates a nexus term on publish | |
* | |
* @param string $id | |
* @param string $post | |
* @return void | |
* @author Dan Cameron | |
*/ | |
function autoadd_nexus_category($id, $post) { | |
if( $post->post_status == 'publish' && false === (wp_is_post_autosave($post) || wp_is_post_revision($post) ) | |
&& !in_array( $post->post_type, array('page')) // array of post types that we do not want to auto-create terms | |
) { | |
wp_set_object_terms($id, array($post->post_title), 'nexus', 1); | |
} | |
} | |
add_action('save_post', 'autoadd_nexus_category', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment