title: variable as Post_type in wp_query - Wordpress
body: <p>I have a question regarding <strong>Wordpress</strong> and selective post type selection.</p>
  
  <p>I am building a template but I am trying to make a function with ACF that when someone makes a page they can select which post type they want to show on this page.</p>
  
  <p>I made a variable with the following in it:</p>
  
  <pre><code>$p = the_field('post_typer');
  </code></pre>
  
  <p>This variable is getting his value when a user is making a page and selects which post type he wants to show.</p>
  
  <pre><code> $p = the_field('post_typer');
  
      // WP_Query arguments
      $args = array(
          'post_type' =&gt;  $p,
  );
  </code></pre>
  
  <p>I am wondering why this is not working:</p>
  
  <pre><code>'post_type' =&gt;  $p,
  </code></pre>
  
  <p>Please help</p>