Get array of current post term ID’s
To get the attached term IDs, use get_the_terms() and wp_list_pluck(): if ( $terms = get_the_terms( $post, ‘director’ ) ) { $term_ids = wp_list_pluck( $terms, ‘term_id’ ); }
To get the attached term IDs, use get_the_terms() and wp_list_pluck(): if ( $terms = get_the_terms( $post, ‘director’ ) ) { $term_ids = wp_list_pluck( $terms, ‘term_id’ ); }
There is no filter or way to stop those Ajax calls. However, you can alter the response of Ajax call by using filter term_search_min_chars. Which is actually to customize minimum number of characters after that Ajax will print the response. So we can make it 0 to never print the response! /** * Remove tag … Read more
If $taxonomy_category is already an array, then: ‘terms’ => array($taxonomy_category) should just be: ‘terms’ => $taxonomy_category where $taxonomy_category is equal to whatever was submitted from your form as $_POST[‘taxonomy_category’] or $_GET[‘taxonomy_category’]
The dynamic filter “term_{$field}” is probably what you’re looking for, where the field is “name.” One approach is to have an array of names and their pseudonyms, then do a check-and-return on them so they’ll display the replacement. add_filter( ‘term_name’, function( $value ) { $terms = [ ‘old’ => ‘new’, ]; // basic example check, … Read more
You are maybe running an old version of WordPress (before 4.5). Before WordPress 4.5.0, the first parameter of get_terms() was a taxonomy or list of taxonomies and since 4.5.0, taxonomies should be passed via the ‘taxonomy’ argument in the $args array (that what you are doing, it should work like that). You will find all … Read more
As per the wordpress documentention, you can limit the showing terms by number. https://developer.wordpress.org/reference/functions/get_terms/ $limit_terms = get_terms( ‘Cast’, array( ‘orderby’ => ‘count’, ‘hide_empty’ => 0, ‘number’ => 50 ) );
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
You shouldn’t need to use a custom SQL query – stick to the built-in method wp_delete_post(). This will also clear out all term relationships too.
If you drop this line in your code, you will see all the properties of $user_blogs. echo ‘<pre>’.print_r($user_blogs,true).'</pre>’; One of them is userblog_id, so you just have to check against it before echoing the blogname. <?php $user_blogs = get_blogs_of_user( $user_id ); if (!$user_blogs) { echo ‘no blogs’; } else { echo ‘<div><ul>’; foreach ( $user_blogs … Read more
YOu can deactive the default tag feature and add via plugin an custom taxonomie, that only list your created tags, like category meta box. Its also possible to design this how the tag meta box.