Why is my category.php in WP showing all posts?
<p>I am trying to configure my category.php in wordpress to show the posts which belong to a specific category.</p>

<p>This is the code of my category.php I'm currently using:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php get_header(); ?&gt;   
    
    &lt;div id="site-wrapper"&gt;
        
        &lt;main id="main"&gt;
            
            
            &lt;h2 id="category_title"&gt;&lt;a href="#"&gt;Kategorie "&lt;?php single_cat_title( '', true ); ?&gt;"&lt;/a&gt;&lt;/h2&gt;
            
                &lt;?php 
                // the query
                $args = array('posts_per_page' =&gt; -1 );
                $the_query = new WP_Query( $args ); 
            
                ?&gt;
            
                &lt;?php if ( $the_query-&gt;have_posts() ) { ?&gt;
            
                    &lt;!-- loop --&gt;
            
                    &lt;?php while ( $the_query-&gt;have_posts() ) {
                     
                                $the_query-&gt;the_post(); ?&gt;
           &lt;article id="post_cat"&gt; 
                  
                        &lt;div id="thumbnail"&gt;
                        
                            &lt;?php if ( has_post_thumbnail() ) : ?&gt;
&lt;a href="&lt;?php the_permalink(); ?&gt;" title="&lt;?php the_title_attribute(); ?&gt;"&gt;
    &lt;?php the_post_thumbnail(); ?&gt;
&lt;/a&gt;
&lt;?php endif; ?&gt;
                    
                    &lt;/div&gt;
                   
                   &lt;h2&gt;&lt;a href="&lt;?php the_permalink();?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;
                   
                   &lt;div class="entry"&gt;
                   
                        &lt;?php the_excerpt(); ?&gt;
                        
                   &lt;/div&gt;
                 
           
           &lt;/article&gt;
           
 
    
                &lt;?php } } else { ?&gt;
                &lt;p&gt;&lt;?php _e( 'Die Posts entsprechen nicht den Kriterien.' ); ?&gt;&lt;/p&gt;
                &lt;?php }  ?&gt;
       
               &lt;!-- end of the loop --&gt;
 
    
               &lt;?php wp_reset_postdata(); ?&gt;
        &lt;/main&gt;
    
    
&lt;?php get_sidebar(); ?&gt;  
&lt;?php get_footer(); ?&gt;</code></pre>
</div>
</div>
</p>

<p>The code looks good but the problem is that all of the posts which are in index.php are displayed.</p>

<p>I hope that someone could help me! Thanks in advance!</p>