Update all posts at once

I got the same need, personally I used wp_set_object_terms after a WP_Query resquest on all of my custom post type. I suppose you could replace my_custom_type with post in the following quote of my code: $my_query = array( ‘post_type’ => array( ‘post’, ‘my_custom_type’ ) ); $the_query = new WP_Query( $my_query ); while ( $the_query->have_posts() ) … Read more

Missing term_id and term_taxonomy_id when adding a term using wp_insert_term() function

The problem is the use of the php function list. If successful, wp_insert_term returns something of the form: array(2) { [“term_id”]=> int(307) [“term_taxonomy_id”]=> int(325) } You can’t use list with this as list only works for numerical arrays. Instead try extract instead: extract($result); echo “<p>The term <i>{$term_name}</i> under the <i>{$term_taxonomy}</i> taxonomy has been added into … Read more

Display Post by taxonomy and taxonomy child if exist

I would use in this case two custom taxonomies: hotel-country stars both none-hierarchical then your query would be as simple as for example hotel in uk with 2 stars: $args = array( ‘post_type’ => ‘hotel’, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘hotel-country’, ‘field’ => ‘slug’, ‘terms’ => array( ‘uk’ ), ), array( … Read more

Display Post by taxonomy and taxonomy child

You should query all accomodation posts in this country, and then sort them by accomodation-type and region. Then you loop through the posts, and compare the accomodation type and the region of each post with those of the previous post. If they are different you print the new accomodation type or region and then print … Read more

Create and move terms for taxonomies

wp_update_term() doesn’t changes taxonomy. It just updated the existing taxonomy. Say the below code- $update = wp_update_term( 1, ‘category’, array( ‘name’ => ‘Uncategorized Renamed’, ‘slug’ => ‘uncategorized-renamed’ ) ); if ( ! is_wp_error( $update ) ) { echo ‘Success!’; } This code finds the category which ID is 1, then updates it to the name … Read more

Search for tags

Yes its very possible, you just need to create your own search form and processing function form: <form name=”tag-search” method=”POST” action=””> <input type=”text” vlaue=”” name=”tag-q” id=”tag-q”> <input type=”submit” name=”tag-submit” id=”tag-submit” value=”Search Tags”> </form> processing: <?php if (isset($_POST[‘tag-submit’]) && $_POST[‘tag-submit’] == “Search Tags” && isset($_POST[‘tag-q’]) && $_POST[‘tag-q’] != “”){ // @todo Sanity check and cleanup $_POST[‘tag-q’] … Read more

Get wordpress taxonomy archive and sort by year

You are over-complicating everything here. What you are doing is not just expensive (because you loose all caches which include post, post meta, term and thumbnail caches), it is totally wrong as well. You are running custom queries which replaces the main query. This in itself makes your page load slower You shouldn’t be running … Read more

Display Custom Taxonomy in Sidebar in Two Columns

As a follow up to @Rutwick Gangurde Answer, here’s an example. Notes: Put it in your functions.php file, call it in the template file. Alter the output by inspecting the $term inside the foreach loop Read the comments inside the function – function wpse25433_terms_list( $cat = array(‘categories’), $el=”li”, $echo = true ) { global $post; … Read more

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