How do I append multiple taxonomies to the URL?

This is certainly possible by utilizing some rewrite rules of your own to some extent. The WP_Rewrite API exposes functions that allow you to add rewrite rules (or ‘maps’) to convert a request to a query. There are prerequisites to writing good rewrite rules, and the most important one is basic regular expression comprehension. The … Read more

How to add images to taxonomies?

Starting from WordPress 4.4, you can use add_term_meta function to store metadata for a term. This is basically a key-value pair information which is stored in wp_termmeta table. Original Answer(Prior to WP 4.4) WordPress doesn’t have the option to add extra information to taxonomies. There isn’t any taxonomy_meta table. So, you have two options. Create … Read more

How to add a default item to a custom taxonomy?

Have a look here: https://web.archive.org/web/20150403012347/http://wordpress.mfields.org/2010/set-default-terms-for-your-custom-taxonomies-in-wordpress-3-0/ Basically what you need to do is use the save_post hook to check the terms for the post and add the default term from your taxonomy if it’s empty. If you just want to have an initial term set in your custom taxonomy, then you can use wp_insert_term(). Probably easiest … Read more

Get the first post term

I’m not sure what you mean by ‘first’ taxonomy… but, $terms = get_the_terms( $post->ID, ‘mytaxonomy’ ); returns an array of taxonomy term objects, so $term = array_pop($terms); Would give you the first term in the array. And then: echo ‘<a href=”‘.get_term_link($term->slug, ‘mytaxonomy’).'”>’.$term->name.'</a>,’ (You may want to include some if statements, in case an empty array … Read more

How to change permalink structure for custom post type and it’s taxonomies?

Ok I think I might have a solution. I have no idea if this is the right way to accomplish this, but as for now it’s the only thing that seems to work. add_filter(‘rewrite_rules_array’, ‘mmp_rewrite_rules’); function mmp_rewrite_rules($rules) { $newRules = array(); $newRules[‘portfolio/(.+)/(.+?).html$’] = ‘index.php?project=$matches[2]’; $newRules[‘portfolio/(.+)/?$’] = ‘index.php?project_category=$matches[1]’; return array_merge($newRules, $rules); } add_filter(‘request’, ‘mmp_rewrite_request’); function mmp_rewrite_request($vars) … Read more

Custom taxonomy list page?

There is nothing built-in to WordPress to provide an “index” page for your taxonomy as your question implies there should be (and I agree, there should be! But there isn’t.) Instead you have to hack it and one way to do that is to create a page called “Main Ingredient” with a main-ingredient URL slug … Read more

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