Filter blog archive by category in URL

Even if default posts are stored in same table but they have different behavior and different characteristics. CPT has post type archive but default post type archived is called as blog and the taxonomy filter is called as tag/category archive. You can access the category/tag archive using For categories: /?cat={category_id} //e.g. ?/cat=5 For tags: /?tag={tag_slug} … Read more

What hooks/filters are there to alter selected terms on post save?

It is always ‘save_post’ (or ‘wp_insert_post’ immediately after this). In $_POST[‘tax_input’] you will find all the terms for all taxonomies associated with the current post. Example: ‘tax_input’ => array ( ‘location’ => array ( 0 => ‘0’, ), ), To change the terms you have to call wp_set_post_terms( $post_ID, $tags, $taxonomy ); manually, just changing … Read more

List post from current taxonomy children

I had an idea of combining the first code with this solution that lists posts from a specifik taxomony: <?php $terms = get_terms(‘productcategories’); foreach ($terms as $term) { $wpq = array ( ‘taxonomy’=>’productcategories’, ‘term’=>$term->slug, ‘order’=>’asc’, ‘orderby’=>’title’); $query = new WP_Query ($wpq); echo “$term->name:<br />”; ?> <?php if ($query->have_posts() ) : while ($query->have_posts() ) : $query->the_post(); … Read more

Custom taxonomy archive – No posts found [closed]

Remember that you must always go to the Page “Settings” -> “Permalinks” and refresh your permalink structure after you add both the Quote Post Type and the Category Taxonomy in your code, otherwise there is no regex with this pattern. Here I’ve got this URL: http://localhost/quotes/category/dev Because you’ve set the rewrite slug to “quotes/category”. But … Read more

Retrieve taxonomy terms in order of their post’s date?

I would use the terms_clauses filter, and then just use get_terms(): function wpse147412_order_terms_by_post_date( $pieces, $taxonomies, $args ) { global $wpdb; if ( ‘post_date’ !== $args[‘orderby’] ) { return $pieces; } $args = wp_parse_args( $args, array( ‘post_types’ => ‘post’ ) ); $pieces[‘fields’] = ‘DISTINCT ‘ . $pieces[‘fields’]; $pieces[‘join’] .= ” JOIN $wpdb->term_relationships AS tr ON tr.term_taxonomy_id … Read more

Change order of WordPress tag cloud

Tags (terms) do not have a menu_order (see the design of the table in the DB). If you want to give terms a ‘menu_order’ you will need to create this yourself. As long as your WP is >= 4.4.0, you can make use of the feature term_meta. This is to terms what post meta is … Read more

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