Title: Can I customize the code so It can work for different post types?
Last modified: February 20, 2017

---

# Can I customize the code so It can work for different post types?

 *  [gcacciola](https://wordpress.org/support/users/gcacciola/)
 * (@gcacciola)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/can-i-customize-the-code-so-it-can-work-for-different-post-types/)
 * First of all, congratulations on the plugin, it is very helpful!
 * Is there any way I can customize it for filtering a different post type? On the
   theme I am working with, there is a post type called Wiki, Id like to filter 
   just as you did on pages. Thank you!

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [jtrip](https://wordpress.org/support/users/jtrip/)
 * (@jtrip)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/can-i-customize-the-code-so-it-can-work-for-different-post-types/#post-9168714)
 * Did you have any luck with this? I am trying to do the same…
 * It seemed like it should be easy to replace the checks against ‘page’ with your
   custom type, as long as it is hierarchical. But that is not working for me.
 *  Thread Starter [gcacciola](https://wordpress.org/support/users/gcacciola/)
 * (@gcacciola)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/can-i-customize-the-code-so-it-can-work-for-different-post-types/#post-9170115)
 * jtrip how experienced is you with coding and wordpress? I am no coder but I am
   great at googling and copying and pasting codes hahaha.
 * I had no answer but I ended up “adapting” the code for my own needs.
 * If you think you can do it, send me a PM and I’ll send you what I did, but you’ll
   have to adapt yourself.
 * I hope it helps.
 *  [jtrip](https://wordpress.org/support/users/jtrip/)
 * (@jtrip)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/can-i-customize-the-code-so-it-can-work-for-different-post-types/#post-9170256)
 * Hi gcacciola, I am _fairly_ experienced at this point, more comfortable with 
   PHP than wordpress in particular but I have been able to implement a few good
   features…
 * I took a look at the code and I was able to get it to work for me, at least so
   far I believe, not sure what kind of troubles I might run into.
 * I would love to try and work with the dev on expanding the functionality of this
   plugin but probably not until I see a GitHub or other public project. I’ll PM
   you what I did in the mean time.
 *  [jtrip](https://wordpress.org/support/users/jtrip/)
 * (@jtrip)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/can-i-customize-the-code-so-it-can-work-for-different-post-types/#post-9170315)
 * [@gcacciola](https://wordpress.org/support/users/gcacciola/) I can’t seem to 
   find how to PM you. Are you on twitter or GitHub?
 *  Thread Starter [gcacciola](https://wordpress.org/support/users/gcacciola/)
 * (@gcacciola)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/can-i-customize-the-code-so-it-can-work-for-different-post-types/#post-9170498)
 * Lol, I can’t either. I’ll post the code here. Whatever.
 * The plugin is to filter a custom post type called WIKI, and i want to filter 
   it by the taxonomy called wiki-category.
 * I hope it helps.
    ` <?php /** * Plugin Name: Categoria-Wiki * Display a custom
   taxonomy dropdown in admin * @author Mike Hemberger * @link http://thestizmedia.
   com/custom-post-type-filter-admin-custom-taxonomy/ */ add_action('restrict_manage_posts','
   tsm_filter_post_type_by_taxonomy'); function tsm_filter_post_type_by_taxonomy(){
   global $typenow; $post_type = 'wiki'; // change to your post type $taxonomy ='
   wiki-category'; // change to your taxonomy if ($typenow == $post_type) { $selected
   = isset($_GET[$taxonomy]) ? $_GET[$taxonomy] : ''; $info_taxonomy = get_taxonomy(
   $taxonomy); wp_dropdown_categories(array( 'show_option_all' => __("Show All {
   $info_taxonomy->label}"), 'taxonomy' => $taxonomy, 'name' => $taxonomy, 'orderby'
   => 'name', 'selected' => $selected, 'show_count' => true, 'hide_empty' => true,));};}/***
   Filter posts by taxonomy in admin * @author Mike Hemberger * @link http://thestizmedia.
   com/custom-post-type-filter-admin-custom-taxonomy/ */ add_filter('parse_query','
   tsm_convert_id_to_term_in_query'); function tsm_convert_id_to_term_in_query($
   query) { global $pagenow; $post_type = 'wiki'; // change to your post type $taxonomy
   = 'wiki-category'; // change to your taxonomy $q_vars = &$query->query_vars; 
   if ( $pagenow == 'edit.php' && isset($q_vars['post_type']) && $q_vars['post_type']
   == $post_type && isset($q_vars[$taxonomy]) && is_numeric($q_vars[$taxonomy]) &&
   $q_vars[$taxonomy] != 0 ) { $term = get_term_by('id', $q_vars[$taxonomy], $taxonomy);
   $q_vars[$taxonomy] = $term->slug; } }
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [8 years, 11 months ago](https://wordpress.org/support/topic/can-i-customize-the-code-so-it-can-work-for-different-post-types/#post-9170530)
 * Side note: there is no PM here and people are discouraged from contact other 
   people directly for support.
 *  Thread Starter [gcacciola](https://wordpress.org/support/users/gcacciola/)
 * (@gcacciola)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/can-i-customize-the-code-so-it-can-work-for-different-post-types/#post-9170534)
 * Alright, its best to leave people without solutions. 3 months with no answer 
   is fine.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Can I customize the code so It can work for different post types?’ is
closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/parent-page-filter_5c6f7e.svg)
 * [Parent Page Filter](https://wordpress.org/plugins/parent-page-filter/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/parent-page-filter/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/parent-page-filter/)
 * [Active Topics](https://wordpress.org/support/plugin/parent-page-filter/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/parent-page-filter/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/parent-page-filter/reviews/)

## Tags

 * [custom post type](https://wordpress.org/support/topic-tag/custom-post-type/)

 * 7 replies
 * 3 participants
 * Last reply from: [gcacciola](https://wordpress.org/support/users/gcacciola/)
 * Last activity: [8 years, 11 months ago](https://wordpress.org/support/topic/can-i-customize-the-code-so-it-can-work-for-different-post-types/#post-9170534)
 * Status: not resolved