Get custom taxonomy value of post and output posts in same taxonomy

try with this function function get_posts_in_taxonomy($post_type, $taxonomy, $term_id, $include_children=false, $limit) { $args = [ ‘post_type’ => $post_type, ‘posts_per_page’ => $limit, ‘tax_query’ => [ [ ‘taxonomy’ => $taxonomy, ‘terms’ => $term_id, ‘include_children’ => $include_children ], ], // Rest of your arguments ]; $posts = new WP_Query( $args ); if($posts->have_posts()) { while($posts->have_posts()) { $posts->the_post(); //code todo here … Read more

Advanced WordPress search form based on custom taxonomy and custom meta value

I’ve recently developed a plugin that can support the custom taxonomy element of this problem. The plugin creates select boxes for each of your custom taxonomy terms and throws the results onto a custom results page (of your choosing): Advanced Custom Post Search It currently doesn’t support custom meta values if this is something you … Read more

Get custom taxonomy term url on archive page

If you are in term archive page, the taxonomy and term is actually set. You could hook wp_head to add the open graph in your functions.php: add_action( ‘wp_head’, ‘wpse_wp_head’ ); function wpse_wp_head () { //First, we check if we are in our custom taxonomy if( is_tax(‘my-custom-taxonomy’) ) { $taxonomy_slug = get_query_var( ‘taxonomy’ ); $term_slug = … Read more

Primary Taxonomy for Post

This post is super old but I’ll post my solution here in case anyone else stumbles across this. If you’re using Yoast SEO you can hook into their existing implementation (they do this already for categories). function add_variety_primary_term_taxonomy( $taxonomies, $post_type, $all ) { if( $post_type == ‘product’ && isset( $all[‘my_custom_tax’] ) ) { $taxonomies[‘my_custom_tax’] = … Read more

Custom taxonomy archive templates not found

The page not found error doesn’t mean that the template file is not found/used. Note that a URL returns a 404 status header (not found), then 404.php is used (or index.php if 404.php doesn’t exist). I think your real problem is that you have not flushed the rewrite rules after the taxonomy has been registered. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)