title: Wordpress : pre_get_posts and passing arguments from author.php to function.php
body: <p>I'm trying to get pre_get_posts to work with passing arguments. I have the following function in my function.php file of my theme.</p>
  
  <pre><code>function cpt_on_author_page( $query, $user_id ) {   
      if ( $query-&gt;is_author() &amp;&amp; $query-&gt;is_main_query() ) {
          $query-&gt;set( 'post_type', 'programs' );
          $query-&gt;set( 'posts_per_page', 1 );
          $query-&gt;set( 'meta_key' , 'show_program_editors');
          $query-&gt;set( 'meta_value' , $user_id);              
      }
  }
  add_action( 'pre_get_posts', 'cpt_on_author_page' );
  </code></pre>
  
  <p>I call this function via my author.php file via this code:</p>
  
  <pre><code> do_action( 'pre_get_posts',$user_id );
  </code></pre>
  
  <p>On the output page, I am getting </p>
  
  <pre><code> Missing argument 2 for cpt_on_author_page()
  </code></pre>
  
  <p>What am I doing wrong?</p>