Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php global $current_user; if ( isset($current_user) ) {echo $current_user->user_login;}?>
- add_action('admin_init','set_user_default_cat_wpa89057');
- function set_user_default_cat_wpa89057(){
- global $current_user;
- if ( isset($current_user) ) {
- update_option( 'default_category', $current_user->user_login);
- }
- }
- function setcategory_2_username($id){
- global $current_user;
- $category_id = get_cat_ID( $current_user->user_login );
- wp_set_post_categories( $post_id, array($category_id) );
- }
- add_action('save_post', 'setcategory_2_username');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement