Fatal error: Call to undefined method stdClass::filter() in wp-includes\taxonomy.php on line 805
Fatal error: Call to undefined method stdClass::filter() in wp-includes\taxonomy.php on line 805
Fatal error: Call to undefined method stdClass::filter() in wp-includes\taxonomy.php on line 805
Call register_taxonomy() with ‘show_admin_column’ => TRUE and WordPress will create your columns automatically. This parameter was added in version 3.5. You don’t need a custom filter anymore. I have written a small plugin to demonstrate this case: t5-taxonomy-location. This is the registration code: protected function register_taxonomy() { $this->set_labels(); $args = array ( ‘labels’ => $this->labels, … Read more
If you want to apply the required attribute every time you use wp_categories_dropdown, use wp_dropdown_cats filter as suggested in other answers: add_filter( ‘wp_dropdown_cats’, ‘wp_dropdown_categories_required’ ); function wp_dropdown_categories_required( $output ){ return preg_replace( ‘^’ . preg_quote( ‘<select ‘ ) . ‘^’, ‘<select required ‘, $output ); } If you want to apply the required attribute only in … Read more
No luck by using plugin provided functions as it gets it’s id by $obj = get_queried_object(); To get the image I use this code snippet: $associations = taxonomy_image_plugin_get_associations(); $tt_id = absint( $taxonomy_term->term_id ); if ( array_key_exists( $tt_id, $associations ) ) { $image_id = absint( $associations[ $tt_id ] ); } $image = wp_get_attachment_image( $image_id, ‘thumbnail’ );
How do I list terms of a custom taxonomy at i.e. domain.com/brands/
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
I guess this function is what you are looking for -> get_ancestors()
Filter pre_get_posts: add_filter( ‘pre_get_posts’, ‘wpse_98213_add_post_types_to_tax_query’ ); /** * Let WP search for custom post types on taxonomy archives. * * @wp-hook pre_get_posts * @param object $query * @return object */ function wpse_98213_add_post_types_to_tax_query( $query ) { if ( ! is_main_query() or ! is_tax( ‘your_taxonomy_name’ ) ) return $query; $query->set( ‘post_type’, array ( ‘portfolio’, ‘post’ ) ); … Read more
I if were you, I’d have two options in my mind. Both hinge on the fact thsi is an inherently expensive computation and no mysql trickery will reduce the load with the data you have. So Option 1, do it the expensive way and store the data for a rainy day You’re going to have … Read more
Nope. Not the WordPress way at least. You could probably make helper function (plain PHP realm in other words) to build instances of label arrays, however that would seriously hinder making strings translatable.