Get current custom user taxonomy

Try this suggestion: $user_id = get_current_user_id(); // Get current user Id $user_groups = wp_get_object_terms($user_id, ‘user-group’, array(‘fields’ => ‘all_with_object_id’)); // Get user group detail foreach($user_groups as $user_gro) { echo $user_gro->name; // Get current user group name echo $user_gro->taxonomy; // get current user taxonomy }

base directories / URL

You can manually create pages named category and app in admin under the Pages menu, and use a custom page template for each to list out taxonomy terms or whatever you need. EDIT – 301 redirect a request that matches the pagename rewrite to another page: function wpa_parse_query( $query ){ if( isset( $query->query_vars[‘pagename’] ) && … Read more

Unable to delete a Category and Tag that share same slug

The problem is WordPress database schema for taxonomies. In database, two terms in 2 different taxonomies with same slug share the same row on terms table. They are differentiate with 2 rows on the terms_taxonomy table. So if you want to delete only the category, you have to perform a custom sql on WordPress database. … Read more

Get and loop posts with all taxonomy terms

Your best option will be to get an array of term ids by using get_terms which belongs to the authors taxonomy and then using that as your array of terms in your tax_query The following requires PHP5.4+ $term_ids = get_terms( ‘authors’, [‘fields’ => ‘ids’] ); // Only get term ids $args = [ ‘tax_query’ => … Read more

functions to create term and child terms

To create a taxonomy, you should use register_taxonomy(). This function accepts three arguments: <?php register_taxonomy( $taxonomy, $object_type, $args ); ?> The documents on the codex are plenty self explanatory. Now, to insert a term into a taxonomy, you can use wp_insert_term(). Again this function accepts 3 arguments: <?php wp_insert_term( $term, $taxonomy, $args = array() ); … Read more

Add a term to an attachment submitted from front end

media handle sideload returns an attachment ID, and attachments are normal posts with the post type ‘attachment’. All the same things apply, featured images parents taxonomies post meta etc albeit with a few attachment oriented functions like wp_get_attachment_image So use wp_set_object_terms as you normally would, e.g.: $id = media_handle_sideload(…. if(!is_wp_error($id)){ wp_set_object_terms( $id, array(terms…), $taxonomy, $append … Read more

Trying to list terms of a custom taxonomy using get_categories

get_categories() fetches taxonomies of type ‘categories’ particularly http://core.trac.wordpress.org/browser/tags/3.6/wp-includes/category.php#L0, to fetch custom taxonomy you should use get_terms() instead, here http://codex.wordpress.org/Function_Reference/get_terms $terms = get_terms( ‘partner-cat’, ‘orderby=count&hide_empty=0’ ); $count = count($terms); if ( $count > 0 ){ echo “<ul>”; foreach ( $terms as $term ) { echo “<li>” . $term->name . “</li>”; } echo “</ul>”; } Make sure … Read more

deneme bonusudeneme bonusu veren sitelerpulibet girişOnwin Güncel Giriştürkçe altyazılı pornocanlı bahis casinocanlı bahis casino siteleriOnwin Güncel Girişholiganbetholiganbet girişholiganbet güncel giriş