Remove date and category filters when editing custom post types

To remove the dates: function my_remove_date_filter( $months ) { global $typenow; // use this to restrict it to a particular post type if ( $typenow == ‘post’ ) { return array(); // return an empty array } return $months; // otherwise return the original for other post types } add_filter(‘months_dropdown_results’, ‘my_remove_date_filter’); To remove categories: function … Read more

Permalink rewrite with custom post type and custom taxonomy

You have to build up the link structure by using filters post_link and post_type_link: add_filter(‘post_link’, ‘territorio_permalink’, 10, 3); add_filter(‘post_type_link’, ‘territorio_permalink’, 10, 3); function territorio_permalink($permalink, $post_id, $leavename) { if (strpos($permalink, ‘%territorio%’) === FALSE) return $permalink; // Get post $post = get_post($post_id); if (!$post) return $permalink; // Get taxonomy terms $terms = wp_get_object_terms($post->ID, ‘territorio’,’orderby=term_order’); if (!is_wp_error($terms) && … Read more

Merging two Custom Post Types into one

You can ran a simple query once and remove it from your code, something like this: if (!get_option(‘updated_my_books’)){ global $wpdb; $wpdb->query(“UPDATE $wpdb->posts SET post_type=”publications” WHERE post_type IN(‘books’,’magazines’)”); update_option(‘updated_my_books’, true); }