Create multiple taxonomies with custom fields values on the fly when creating new posts

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

How to show Custom Post Types under Taxonomy in a new WordPress page template?

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

Filter language in Polylang for custom taxonomy

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

Dynamic template page calling shared taxonomies CPT or Plugin post type : how to clone taxonomy for plugin + set up dynamic shortcode

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