archive by year and category: permalink support doesn’t work on pagination
archive by year and category: permalink support doesn’t work on pagination
archive by year and category: permalink support doesn’t work on pagination
What you need is to add a tax_query to your WP_Query arguments, where you check that your taxonomy exists on the posts you are querying. Here is an example that fetches the 3 latest published posts that have the taxonomy site set. $args = array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 3, ‘tax_query’ … Read more
WordPress 5.4 and higher: Filter posts by category 1 AND category 2 in API requests
Is it possible to prevent the deletion of taxonomy by detecting $_GET request
You can add the action on the init itself, just increase the priority of the add_action call. The higher the priority the later the function is called. add_action(‘init’, ‘retrieve_my_terms’, 9999); But my suggestion is that you should do these kind of things as late as possible, preferably just before the first time they are used. … Read more
Can you try to escape the variable $post_id? Like so: ”.$post_id.” So use the single quote twice. You are querying a slug and your variable is a number.
WP Query should show No Posts when tax_query $args taxonomies don’t have associated posts
I was building something similar a couple of years ago, here’s what I did, maybe it helps … (changed to your use case) $result = new WP_Query([ ‘post_type’ => ‘location’, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘posts_per_page’ => -1, // all of them on one page ‘tax_query’ => [ [ ‘taxonomy’ => ‘services’, ‘field’ => … Read more
Taxonomy terms are not checked when edit custom post
Add terms to a taxonomy archive from within the same taxonomy