How to get the $meta_type given the $object_id

Given the $object_id (and a WP_Term object), how does one go about determining the $meta_type to be passed to update_metadata()? Unfortunately, that is not possible because each object has its own table and therefore the same ID (1, 2, 3, etc.) could refer to a post, comment, term, etc. So that’s why we have different … Read more

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

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

For each loop on every word in post

Are you sure you want to link every instance of each ingredient? As a user, I wouldn’t mind if the ingredient list above the recipe had all its ingredients linked, but if the following instructions continued linking every ingredient I’d find that to be a lot of links I could accidentally tap on and lose … Read more

Get_the_terms restrict output

you can change you code a bit : $taxonomy = ‘country’; $terms=get_the_terms($post->ID,$taxonomy); if($terms) { echo ‘<h1>Holiday ‘; $total_count = count($terms); $country_count = 1; foreach( $terms as $termcountry ) { if ($country_count = 1){ echo ‘in ‘.$termcountry->name; }else{ if ($total_count = 2){ echo ‘ And ‘.$termcountry->name; }else{ echo ‘, ‘.$termcountry->name; } } $country_count = $country_count + … Read more

Proper use of wp_get_object_terms

To fetch the archive url for that taxonomy term, use something like this (I’m using your naming conventions above, and assuming that $theZielgruppe is a term object. $url = get_term_link( $theZielgruppe, ‘ge_zielgruppe_taxonomy’ ); To get the name, just use $theZielgruppe->name Is that what you’re looking for? EDIT The link above would then look like this: … Read more