admin管理员组

文章数量:1418656

I am working on clients website and I have added the Custom post type plugin for creating the new section and I have also added the taxonomies for that.

In my page, I have added the default categories drop-down select box but the problem is that, it is not showing the taxonomies added for the Custom post type.

So, I went to the wp-includes/category-template.php and edited the file.

 function wp_dropdown_categories( $args = '' ) {
    $defaults = array(
        'show_option_all'   => '',
        'show_option_none'  => '',
        'orderby'           => 'id',
        'order'             => 'ASC',
        'show_count'        => 0,
        'hide_empty'        => 1,
        'child_of'          => 0,
        'exclude'           => '',
        'echo'              => 1,
        'selected'          => 0,
        'hierarchical'      => 0,
        'name'              => 'cat',
        'id'                => '',
        'class'             => 'postform',
        'depth'             => 0,
        'tab_index'         => 0,
        'taxonomy'          => 'project_type',
        'hide_if_empty'     => false,
        'option_none_value' => -1,
        'value_field'       => 'term_id',
        'required'          => false,
    );

    $defaults['selected'] = ( is_category() ) ? get_query_var( 'cat' ) : 0;

    function wp_list_categories( $args = '' ) {
    $defaults = array(
    'child_of'            => 0,
    'current_category'    => 0,
    'depth'               => 0,
    'echo'                => 1,
    'exclude'             => '',
    'exclude_tree'        => '',
    'feed'                => '',
    'feed_image'          => '',
    'feed_type'           => '',
    'hide_empty'          => 1,
    'hide_title_if_empty' => false,
    'hierarchical'        => true,
    'order'               => 'ASC',
    'orderby'             => 'name',
    'separator'           => '<br />',
    'show_count'          => 0,
    'show_option_all'     => '',
    'show_option_none'    => __( 'No categories' ),
    'style'               => 'list',
    'taxonomy'            => 'project_type',
    'title_li'            => __( 'Categories' ),
    'use_desc_for_title'  => 1,
   );

   $r = wp_parse_args( $args, $defaults );

In place of 'taxonomy' => 'category', I added this 'taxonomy'=> 'project_type', Now the taxonomies are showing but the search according to the drop-down select box is not working. It is showing page not found.

Do I have to go the Setting > Permalinks and click save button?

Any help is much appreciated.

本文标签: custom post typesTaxonomies are not showing in the category dropdown