Get custom product attributes in Woocommerce

In Woocommerce, I am trying to get product custom attribute values but I fail miserably and I don’t get anything. So I tried: global $woocommerce, $post, $product; $res = get_post_meta($product->id); print_r(unserialize($res[‘_product_attributes’][0])); And I’m getting this raw data: [pa_koostis] => Array ( [name] => pa_koostis [value] => [position] => 0 [is_visible] => 1 [is_variation] => 0 … Read more

Get all active posts that are tied to a custom taxonomy for a custom post type

I need to display all the categories I created for a custom post type then inside of each category I need to loop all the posts that are tied to that category. I tried constructing my WP_Query a number of different ways and I can’t get it to work at all. Here’s the code I … Read more

Getting Catategory / Taxonomy Description on Non-archive Pages

Can you pull in the description of a custom tax on pages other than the taxonomy-(custom-tax).php i.e on the home page you want to show the description of a custom tax. This works on the aforementioned archive page but nowhere else: <?php echo term_description( ”, get_query_var( ‘taxonomy’ ) ); ?> Many thanks for any help. … Read more

Is the only way to add taxonomy terms via an admin panel?

Is it possible to register taxonomy terms programmatically from a plugin? I would like to add a custom taxonomy ‘geographical area’ and also prepopulate the taxonomy with a list of areas in the UK. public function sample_taxonomy() { // create a new taxonomy register_taxonomy( ‘resellers’, ‘wps-reseller’, array( ‘label’ => __( ‘Geographical Areas’ ), ‘rewrite’ => … Read more

How to display Custom taxonomy on custom post listing page [duplicate]

This question already has an answer here: Showing current taxonomy terms (1 answer) Closed 7 years ago. I want to show the custom taxonomy name on the listing of custom post type on my front end Answer You can get terms by posts with this functions. $term_list = wp_get_post_terms($post->ID, ‘my_taxonomy’, array(“fields” => “ids”)); And echo … Read more

How much worse is querying custom fields compared to custom taxonomies, quantitatively

OK, I know (because i’ve read it many times) why custom fields is less efficient than custom taxonomies when it comes to querying/filtering posts, but just how inefficient is it by comparison? I’d love some researched quantitative statistics to back this up. What sort of number of posts and custom fields are we talking about … Read more

Advise on Custom Taxonomies and Structure

I am building a sporting website with the following structure Categories Events (Like Superbowl 2017) Deals (Posts like “Fly to USA to Watch Superbowl for $1000” etc) News (Posts like “Sanfransisco make superbowl 2016”) Tours (Posts Like “Group tours to USA for Superbowl”) Now I am struggling with the taxonomies. I was thinking of using … Read more