How Can I Change a Taxonomy URL Based On The Originating URL?

The term_link filter has a different signature for its callback function than the page_link filter, meaning the arguments in your callback are different. (Also note you’ll need to explicitly set the argument number when you call add_filter because by default add_filter will only setup 1 argument. For example: add_filter( ‘term_link’, ‘lqd_series_link’, 10, 3 ); // … Read more

Term count by user

It’s a little bit hard to guess, what are you trying to do exactly, but let me try to answer… My best guess is that you want to tell, how many properties has given user published in given property type. So first – why your code doesn’t work… get_term will get the term info and … Read more

Use get_the_terms to list subcategories of custom taxonomy

When you use get_the_terms() it returns a term object. One of the fields is ‘parent’ which stores the ID of the term parent. So you can compare the current term’s parent to the parent term that you are looking for. $desired_parent_name=”fruits”; $desired_parent_id = get_term_by(‘name’, $desired_parent_name)->term_id; foreach ($terms as $term) { if $term->parent == $desired_parent_id { … Read more

Print terms with taxonomy and metabox value

Try This: $args = array( ‘hide_empty’ => false, ‘relation’ => ‘OR’, array( ‘key’ => ‘serial_language’, ‘value’ =>’english’, ‘compare’ => ‘LIKE’ ), array( ‘key’ => ‘serial_language’, ‘value’ =>’arabic’, ‘compare’ => ‘LIKE’ ), ‘taxonomy’ => ‘serial’, ); $terms = get_terms( $args ); hope this will help

WordPress User Taxonomy Saved Values

There are two errors in your code. First one is the inconsistency in field names. Here’s your checkbox field: <input type=”checkbox” name=”competence-<?php echo esc_attr( $term->slug ); ?>” id=”competence-<?php echo esc_attr( $term->slug ); ?>” value=”<?php echo esc_attr( $term->slug ); ?>” <?php checked( true, is_object_in_term( $user->ID, ‘competence’, $term ) ); ?> /> And here’s the part you’re … Read more

how to get URL of media uploaded to WordPress via media_handle_sideload()

To get the URL of the uploaded image/attachment, you can use wp_get_attachment_url() (which always returns the full-sized image URL) or wp_get_attachment_image_url() for image attachment: // This is how you should call uploadImageToMediaLibrary(); assign the value to $att_id. $att_id = uploadImageToMediaLibrary($post->ID, $external_url, “custom_alt”); $url = wp_get_attachment_image_url( $att_id, ‘full’ ); // full-sized URL But to set the … Read more