is_taxonomy is deprecated. What’s the alternative?

See Codex page for is_taxonomy This function is deprecated as of Version 3.0. Please use taxonomy_exists instead. wp_insert_term uses taxonomy_exists to check if the taxonomy exists. This means if the taxonomy is a registered taxonomy. (It would be odd if wp_insert_term only you allowed to add a term to taxonomies with existing terms 🙂 ) … Read more

Set attachment tags from attachment’s custom field data

I managed to make it work but not fully. First, the code you provided is not retrieving an already saved post_meta. I based my code in the introductory code of this tutorial: http://wpengineer.com/2076/add-custom-field-attachment-in-wordpress/ And am using the regular post_tag taxonomy instead of a custom one. And, lastly, there’s a bug, after you close the Media … Read more

Use get_terms to get post_tags but limit to a taxonomy

I’m fairly certain that the taxonomies have nothing truly in common except posts that they share, so I think you can’t avoid running an actual query of posts, in order to learn which categories are candidates for your criteria. While, it may not be computationally the best method, you could do something like this… $args … Read more

Order custom Taxomony alphabetically and reversal after clicking a button?

Pass order parameter in url on click on link like /?order=DESC or if you are using a button then it must be submitting a form with order field value change GET to POST and field name if(isset($_GET[‘order’])){ $order = $_GET[‘order’]; } else{ $order=”ASC”; } $categories = get_terms( ‘category’, array( ‘orderby’ => ‘name’, ‘order’=> $order, ) … Read more

get_the_terms error

I ended up using the wp_get_object_terms() function instead of get_the_terms(). The get_the_terms() function attempts to cache the terms where wp_get_object_terms() does not. The fixed code to get the hero images CPT’s ID is: $hero_image_id = ( $assigned_hero_images = wp_get_object_terms( $post_parent, ‘hero_images’ ) ) && ( $hero_image = array_shift( $assigned_hero_images ) ) && isset( $hero_image->term_id ) … Read more

Using pre_get_posts for taxonomy post count

I answered my own question I just implemented it wrong when testing it on my end (mis-typed the taxonomy). This is correct: // Change the number of posts that show up on the taxonomy template function custom_tax_post_count ( $query ) { if (($query->is_tax(array(‘taxonomy_1’, ‘taxonomy_2’)) )) $query->set( ‘posts_per_page’, ‘-1’ ); } add_action( ‘pre_get_posts’, ‘custom_tax_post_count’ );

How to display terms from a custom taxonomy in a hierarchy AND with custom html markup?

Solved it with the following Custom Walker: class CustomWalker extends Walker_Category { function start_el(&$output, $item, $depth=0, $args=array()) { $output .= “\n<li><a href=\”http://website.com/?ls=&location=” . $item->slug . “\”>”.esc_attr($item->name); } function end_el(&$output, $item, $depth=0, $args=array()) { $output .= “</li>\n”; } }

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