Ordering posts by custom taxonomy in admin area

Here is what I do to sort my custom post type by custom taxonomy in the admin. I have a custom post type called plugin_filter and a custom taxonomy assigned to it called filter_group. I add the following filter to my plugin to make the field sortable. add_filter(“manage_edit-plugin_filter_sortable_columns”, ‘plugin_filter_sort’); function plugin_filter_sort($columns) { $custom = array( … Read more

Allowing specific users to only add posts using certain custom taxomy terms

First hook the save_post action: http://codex.wordpress.org/Plugin_API/Action_Reference/save_post Then check capabilities: You have docs on that right? Then get_the_terms for the $post_id provided by save_post and the taxonomy you want to check. http://codex.wordpress.org/Function_Reference/get_the_terms Then if they are using a term (see note below) they are not allowed to use either stop/delete the post, set a warning, or … Read more

wp_dropdown_categories in custom post type with custom taxonomy

get post id $post_id=get_the_ID(); get selected region $terms = wp_get_post_terms( $post_id, $taxonomy ); $selected_id=”; if(isset($terms[0]->term_id)){ $selected_id=$terms[0]->term_id; } build hierarchical dropdown wp_dropdown_categories( array( ‘show_option_all’ => ‘Choose a region’, ‘show_option_none’ => ”, ‘orderby’ => ‘ID’, ‘order’ => ‘ASC’, ‘show_count’ => 0, ‘hide_empty’ => 0, ‘child_of’ => 0, ‘exclude’ => ”, ‘echo’ => 1, ‘selected’ => $selected_id, ‘hierarchical’ … Read more

custom post type and custom taxonomy permalink

Something similar to this in your functions.php or a plugin will do the trick: function custom_rewrite( $wp_rewrite ) { $feed_rules = array( ‘([^/]+)/cases/([^/]+).html’ => ‘index.php?genre=”. $wp_rewrite->preg_index(1) .”&case=”. $wp_rewrite->preg_index(2) ); $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules; } // refresh/flush permalinks in the dashboard if this is changed in any way add_filter( “generate_rewrite_rules’, ‘custom_rewrite’ ); You will need … Read more