My taxonomy won’t be registered. Can’t see it in my back-end
You forgot to add action hook on your code. Please use below the action add_action( ‘init’, ‘create_book_taxonomies’, 0 );
You forgot to add action hook on your code. Please use below the action add_action( ‘init’, ‘create_book_taxonomies’, 0 );
I was looking for the same thing and think this should work for you : Custom taxonomy, get_the_terms, listing in order of parent > child
Problem with your code is that you don’t modify queries at all in any way, so all queries on your site still get these posts – so they are visible on lists. And later, you use template_include filter which allows you to redirect single post view and single category archive if it shouldn’t be visible … Read more
Custom Taxonomies will be specific to each site. If you were to create your custom taxonomies as a plugin, you could activate this plugin in all sites and all of them will have the custom taxonomies. BUT, even then, the data that you enter into each of the taxonomies will be unique to each site. … Read more
You shouldn’t need to use a custom query for this. Just link to the term’s existing archive page which will automatically list all posts in that term. You can do this using get_term_link(). For example, this displays the URLs for each term in the taxonomy: $terms = get_terms( [ ‘taxonomy’ => ‘conseil’ ] ); foreach … Read more
It looks like you’re using the new Block Editor (Gutenberg). In such case, you should know that this editor is based on REST. So if you want to see your custom taxonomy in this editor, you have to make it visible in rest. You should set show_in_rest parameter to true. $args = array( ‘labels’ => … Read more
You’ve posted just the part of code that is responsible for getting the slider, I guess, so it’s a little bit hard to know, where exactly do you use it. But I assume that you use template hierarchy correctly and you use category archives. If so, then you can get current term ID with get_queried_object_id() … Read more
Your 3rd option is correct. $args3 = array( ‘posts_per_page’ => 9, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, // If you’re only specifying one. Use array( ‘projects’, ‘post’ ); for many. ‘post_type’ => ‘projects’, // This is the correct syntax for a taxonomy query. ‘tax_query’ => array( array( ‘taxonomy’ => ‘projects_categories’, ‘terms’ => $cat_id, ), ), … Read more
As SallyCJ mentioned, gettext is really the only option you have with this, because the Slug labels are hardcoded in the Core of WordPress. https://core.trac.wordpress.org/browser/tags/5.2/src/wp-admin/edit-tags.php#L439 Here is a snippet I wrote and tested that should work for you, and it will only run on the backend and only on the two pages where you will … Read more
If you add another tax_query to the args, the last tax_query will replace the previous tax_query. But anyway, if these are the criteria: When filtering by type alone, show only resources posts in that type. When filtering by subject alone, show only resources posts in that subject. When filtering by type and subject, show only … Read more