Custom post types does not work correctly

0

I have created two "Custom Post Type", with the following names "Films" and the other "Series", both use the same "Register Taxonomy".

HoweverwhenIdoasearchsuchas:

Whenfilteringonlythe"Action" genre, the site returns me to other posts that do not have the same genre, the system lists all movies and series and ignores the term filtering.

Here is the function of the "Custom Post Type" Movies (The Series and identical, only changes the parameters of the function, logico kkk)

add_action( 'init', 'post_type_movies' );

function post_type_movies() {

  $labels = array(
    'name'                => __( 'Filme', mundothemes ),
    'singular_name'       => __( 'Filmes', mundothemes ),
    'add_new'             => __( 'Adicionar Novo', mundothemes ),
    'add_new_item'        => __( 'Adicionar Novo Filme', mundothemes ),
    'edit_item'           => __( 'Editar Filme', mundothemes ),
    'new_item'            => __( 'Novo Filme', mundothemes ),
    'all_items'           => __( 'Todos os Filmes', mundothemes ),
    'view_item'           => __( 'Ver Filme', mundothemes ),
    'search_items'        => __( 'Pesquisar Filme', mundothemes ),
    'not_found'           => __( 'Nenhum filme encontrado', mundothemes ),
    'not_found_in_trash'  => __( 'Nenhum filme na lixeira', mundothemes ),
    'menu_name'           => __( 'Filmes', mundothemes ),
  );

  $supports = array( 'title', 'editor', 'thumbnail', 'comments');

  $slug = get_theme_mod( 'movies_permalink' );
  $slug = ( empty( $slug ) ) ? 'filmes' : $slug;

  $args = array(
    'labels'              => $labels,
    'public'              => true,
    'publicly_queryable'  => true,
    'show_ui'             => true,
    'show_in_menu'        => true,
    'query_var'           => true,
    'rewrite'             => array( 'slug' => $slug ),
    'capability_type'     => 'post',
    'has_archive'         => true,
    'hierarchical'        => false,
    'menu_position'       => 4,
    'supports'            => $supports,
    'menu_icon'           => 'dashicons-editor-video',
  );

  register_post_type( 'filmes', $args );

}

Here is the function of the "Register Taxonomy" Genre (This function I use in both Custom Post Type)

add_action( 'init', 'custom_taxonomy_genre', 0 );

function custom_taxonomy_genre() {
    register_taxonomy(
        'genero', // COLOCAR EM PT-BR
        array('series','filmes'), // DEFINE O TIPO DE POST - CUSTOM POST TYPE
        array( 'hierarchical' => true, 'label' => 'Gênero', 'query_var' => true, 'rewrite' => true )
    );   
}

I do not know the reason for this error, do I need to add something else to the function or reason and another?

    
asked by anonymous 29.05.2018 / 19:27

0 answers