Get Comma Seperated Taxonomy Linked Terms and Last Child Separated By “&” Instead Of Comma

What you’re asking is a generic PHP/programming question, and this: “It links all terms to the last term link only“, is because your code clearly is attaching the link (i.e. the last value assigned to $term_link) to the entire list ($entry_terms), i.e. echo ‘<a href=”‘ . esc_url( $term_link ) . ‘”>’ . $entry_terms . ‘</a>’. … Read more

Custom Post Types not queried in Custom Taxonomy archives or Native archives

Tags shared by CPTs and standard posts return only the latter, and topics archives or tag archives with only CPTs assigned return empty. As for the tag archives, that’s a default behavior in WordPress core, i.e. tag (post_tag taxonomy) and category (category taxonomy) archives will only query posts where the type is post. However, the … Read more

Set term on an attachment using wp_set_object_terms and want to display the full term text but it’s showing a slug instead

When a visitor fills out the email address field with “[email protected]”, what is displayed on the Attachment details screen (as in siteurl.com/wp-admin/upload.php?item=xx ) for that email field is “nameemail-com”. Yes, and that is the default behavior, i.e. WordPress displays the term slug instead of name (or the actual email address in your case). But there’s … Read more

Take a custom taxonomy value and save as a standard Product Tag

Got it worked out, working code as follows: function action_save_product_data( $post_id ) { if ( ‘product’ !== $post->post_type ) { $terms = wp_get_post_terms( $post_id, ‘product_brand’, array( ‘fields’ => ‘all’ ) ); if ( $terms ) { $prod_brand = $terms[0]->slug; wp_set_object_terms( $post_id, $prod_brand, ‘product_tag’, true ); } } }