Automatically Populate Post Taxonomy Data Based on Post Author Meta Data?

Figured it out for anyone who wants to know: function update_school( $post_id ) { $post_author_id = get_post_field( ‘post_author’, $post_id ); // get the post author ID $school_name = get_the_author_meta( ‘school2’, $post_author_id ); // from the post author ID, get the author meta $term = term_exists( $school_name, ‘school’); wp_set_post_terms( $post_id, $term, ‘school’ ); } // run … Read more

Save selectlist value (taxonomy) in wp:wp_set_object_terms

solved it so: $part_brand = get_terms(‘brands’, ‘hide_empty=0′); <label for=”part_brand”>Бренд</label> <select name=”part_brand” id=’part_brand’> <option value=”” <?php **$brand_names = wp_get_object_terms($post->ID, ‘brands’);** if (!count($brand_names)) echo “selected”; ?>>None</option> <?php foreach($part_brand as $brand) { if (!is_wp_error($brand_names) && !empty($brand_names) && !strcmp($brand->slug, $brand_names[0]->slug)) echo “<option value=”” . $brand->slug . “” selected>” . $brand->name . “</option>\n”; else echo “<option value=”” . $brand->slug . … Read more

Why won’t this rewrite rule work?

You have to make your rewrite rules account for the paged parameter, because otherwise they won’t. It would look somewhat like shown below. function test_add_rewrite_rules() { add_rewrite_rule( ‘businesses/(eat|stay|play)/(.+)/page/([0-9]+)/?$’, ‘index.php?post_type=businesses&display_category=$matches[1]&filters=$matches[2]&paged=$matches[3]’, ‘top’ ); add_rewrite_rule( ‘businesses/(eat|stay|play)/page/([0-9]+)/?$’, ‘index.php?post_type=businesses&display_category=$matches[1]&paged=$matches[2]’, ‘top’ ); } add_action( ‘init’, ‘test_add_rewrite_rules’ );

predefined custom field on registration page

Find <div id=tab2_login” and replace it with following code.Assuming you will change CSS and JS accordingly. <div id=”tab2_login” class=”tab_content_login” style=”display:none;”> <h3>Register for this site!</h3> <p>Sign up now for the good stuff.</p> <form method=”post” action=”<?php echo site_url(‘wp-login.php?action=register’, ‘login_post’) ?>” class=”wp-user-form”> <div class=”username”> <label for=”user_login”><?php _e(‘Username’); ?>: </label> <input type=”text” name=”user_login” value=”<?php echo esc_attr(stripslashes($user_login)); ?>” size=”20″ id=”user_login” … Read more