custom post type taxonomy “tag” archive : no post found

Tag and Category archive queries default to querying only the post post type, to add your custom post type to those queries, you can use the pre_get_posts action: function wpa_cpt_tags( $query ) { if ( $query->is_tag() && $query->is_main_query() ) { $query->set( ‘post_type’, array( ‘post’, ‘object’ ) ); } } add_action( ‘pre_get_posts’, ‘wpa_cpt_tags’ );

Loop through custom taxonomies and display posts

I thought I would provide another answer as the above one is a little hacky, also I added another layer that gets all taxonomies for a post_type. $post_type=”post”; // Get all the taxonomies for this post type $taxonomies = get_object_taxonomies( (object) array( ‘post_type’ => $post_type ) ); foreach( $taxonomies as $taxonomy ) : // Gets … Read more

Custom columns on edit-tags.php main page

You can do this by hooking into the ‘taxonomy’_edit_form and edited_’taxonomy’ actions. add_action(‘taxonomy_edit_form’, ‘foo_render_extra_fields’); function foo_render_extra_fields(){ $term_id = $_GET[‘tag_ID’]; $term = get_term_by(‘id’, $term_id, ‘taxonomy’); $meta = get_option(“taxonomy_{$term_id}”); //Insert HTML and form elements here } add_action(‘edited_taxonomy’, ‘bar_save_extra_fields’, 10, 2); function bar_save_extra_fields($term_id){ $form_field_1 = $_REQUEST[‘field-name-1’]; $form_field_2 = $_REQUEST[‘field-name-2’]; $meta[‘key_value_1’] = $form_field_1; $meta[‘key_value_2’] = $form_field_2; update_option(“taxonomy_{$term_id}”, $meta); } … Read more

Query Custom Post by Taxonomy Category

There are 3 ways of doing that: a) … ‘category_name’ => ‘category-1’ … b) … ‘taxonomy’ => ‘category’, ‘term’ => ‘category-1’, … c) … ‘tax_query’ => array( array( ‘taxonomy’ => ‘category’, ‘field’ => ‘slug’, ‘terms’ => array( ‘category-1’ ) ) ) … More info: http://codex.wordpress.org/Function_Reference/WP_Query

Add default WordPress tag meta box to User Profile

This code works for me. It uses ‘locations’ custom taxonomy and ‘suggest’ javascript. You need to extend it to support multiple term selection. Add custom field to user-edit screen and store metadata when user/admin updates profile // for account owner add_action(‘show_user_profile’, ‘add_custom_user_profile_fields’); add_action(‘personal_options_update’, ‘save_custom_user_profile_fields’); // for admins add_action(‘edit_user_profile’, ‘add_custom_user_profile_fields’); add_action(‘edit_user_profile_update’, ‘save_custom_user_profile_fields’); function add_custom_user_profile_fields($user) { printf( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)