what tables uses wp_get_post_terms

I have a (uncommented) legacy code that is using wp_get_post_terms function, and always returns WP_Error (Invalid Taxonomy). The calling of the function is: $location = wp_get_post_terms($post_id, “location”); I had been inspecting the database, and the first conclusion is that in the table wp_term_taxonomy there are many entries with “location” into taxonomy field. So I have … Read more

Outputting an array of term meta values in a custom WooCommerce tab?

Forgive me – my WordPress/PHP skills are hilariously rudimentary, so I may not use the correct terminology. I have added a custom tab to the WooCommerce single product page and need it to display a number (sometimes single, sometimes multiple) of term meta values related to a custom taxonomy, ‘book-author’. These values are created in … Read more

Custom taxonomy list and sortby letter pagination problem

I’m getting a taxonomy list page with pagination using this code : <?php $sortby = $_GET[‘sortby’]; if(isset($_GET[‘showall’])): $args = array(‘hide_empty’ => 0); else: $page = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $per_page = 1; //number of actores to show per page $offset = ($page-1) * $per_page; $args = array(‘number’ => $per_page, ‘offset’ => $offset, ‘hide_empty’ => … Read more

Output the content of a term organised by each of the CPT?

I have four CPT and several shared Custom Taxonomies for all. I need to retrieve and output the content of a term (let’s say “environmental-crisis” of the shared taxonomy “Crisis Type”, and organise the output by each of the CPT, so the final result hopefully looks like this (or something alike): Custom Post Type – … Read more

How to order and count get_terms by specific post type?

I want to get a list of taxonomy “company” terms which have a particular meta value and which are associated with posts of custom type “viewpoint”. Beginning with getting Viewpoint posts, as per recent answer, WordPress’ get_posts() supports populating the resulting array with a fields value of only post ids… $vp_post_args = array( ‘post_type’ => … Read more

Change default ordering of taxonomy terms – pre_get_terms

I wanted to change the default taxonomy terms order by its ‘term_order’ value instead of ‘name’ in admin side. So I tried something like below. But it doesn’t work and php memory exhaust. function uc_order_term( $wp_query ) { $wp_query->query( array( ‘taxonomy’ => ‘category’, ‘orderby’ => ‘term_order’, ‘order’ => ‘ASC’ ) ); } add_action( ‘pre_get_terms’, ‘uc_order_term’); … Read more