orphaned taxonomy terms remove by sql query
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.
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.
My gut instinct would be to roll my own AJAX callback. You obviously know the post ID (since you have it on the front end) and the names of the fields, just post that back to WP using AJAX and programmatically set the values there. An untested example (props to Kailey Lampert): // Add checkboxes … Read more
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
You can insert an associative array into the post_meta_field. Here is a quick little function to grab the data afterward (did not test): function grab_task_name_array($post_id) { $new_array = array(); $array = get_post_meta($post_id,’_task-name’); //do not put true as third parameter (this would return string and not array) foreach($array[0] as $key => $value) $new_array[$key] = $value; return … Read more
To expand on my comment above, you would replace your code with something like this: print_taxonomy_ranks( get_the_terms( $post->ID, ‘post_tags’ ) ); and in your function print_taxonomy_ranks you’d replace the echo statement with your preferred output. function print_taxonomy_ranks( $terms ) { // if terms is not array or its empty don’t proceed if ( ! is_array( … Read more
Ok well without any help from here……. I was able to figure out how to change the option and select values of wp_dropdown_categories to display the child terms of the current taxonomy being viewed- First I placed this code into my functions file, which creates a walker class – class SH_Walker_TaxonomyDropdown extends Walker_CategoryDropdown{ function start_el(&$output, … Read more
It depends of what you are trying to do exactly. But if you want the same functionality of the question you linked, you can use the same function but passing your custom taxonomy to the function. Here all the arguments you can pass to wp_list_categories() and is defulat values: <?php $args = array( ‘show_option_all’ => … Read more
Ok, I think I’ve figured out a viable solution. Kinda disappointed that there’s no way I’ve found thus far to hook directly into trash_{custom_post_type} like I was able to on the publish_{custom_post_type} hook. Here’s a solution for anyone else struggling with this issue. If anyone has any better suggestions, please feel free to share! /** … Read more