How to retrieve taxonomy Metabox fields in frontend
You need to use $term->term_id not get_queried_object_id() in get_term_meta
You need to use $term->term_id not get_queried_object_id() in get_term_meta
First of all, you can do foreach inside foreach. In fact, you can nest loops to much higher level based on your server configuration. If you are going to use only one term in that field, make sure you select Field Type as Radio or Select and Return Value as Term Object. In that case, … Read more
get_field() and have_rows() work with post/term ID, not the whole “queried object“. You should try $term = get_queried_object()->term_id; in line 1. Also it is unnecessery to set $term again at line 3.
This is the code I use to insert a list of taxonomy terms in a dedicated plugin category. On can also directly add the terms to the main post category. // ************** Add taxonomy $taxonomy_term = “my_term”; $taxonomy_category = “my_taxonomy_category”; if (null !==(get_the_ID())) { if ( taxonomy_exists( $taxonomy_category ) ){ // if the tag doesn’t … Read more
Add terms to a taxonomy archive from within the same taxonomy
I see a few things that may be causing problems. To answer your question though, this line: $loop = new WP_Query( array( ‘post_type’ => ‘subjects’, ‘posts_per_page’ => ‘3’ ) ); is performing a query on a post type called “subjects”. I think you want to be pulling your quizzes. So the line should be: $loop … Read more
Nevermind, I finally found. This is not documented, but going through Polylang code I found a way. First retrieve the languages with their taxonomy id with $lang = get_terms(‘term_language’, [‘hide_empty’ => false]) which gives an object that can be called as $lang->name and $lang->term_id. Then, the wp_query should look like this: $args = array( ‘post_type’ … Read more
How to filter and/or sort user taxonomy query inside custom user taxonomy archive page?
If you just want to check if a term with a specific slug exists in the database, then you can use term_exists(). E.g. <?php if ( term_exists( $cptTax, ‘tax1’ ) ) : ?> Your form here. <?php endif; ?> But if you do meant to check if the term is in a specific terms array, … Read more
The solution for now is : create a plugin re-creating the shortcode with the current page slug. Naming the page slug like the category slug. And manually add the category to dflip. Couldn’t find better so far. // Disable direct access defined(‘ABSPATH’) or die(‘No script kiddies please!’); // use page slug to call dflip book … Read more