title: How do I add a meta tag to the page template from a WordPress plugin?
body: <p>I want to add a meta tag like this one:</p>
  
  <pre><code>&lt;meta name="key" content="value" /&gt;
  </code></pre>
  
  <p>to some of the pages in WordPress. I know, I can add this into my template and it will show up. But the thing is, <strong>I am not allowed to even touch the template. It's totally template independent.</strong></p>
  
  <p>So, I have to add the meta tag only by doing something in my plugin code. I have tried <code>wp_head</code> action hook, but it is not working. Is there a workaround or anything to get the meta tag inside the head tags of the pages dynamically?</p>
  
  <h2>What I'm doing</h2>
  
  <p>What I'm doing is a little different. There are two pages in my blog, the main content page and <em>Summary</em> page. Both of these pages get data through shortcodes. So, the main content page has a shortcode</p>
  
  <pre><code>[mainpage]
  </code></pre>
  
  <p>And the <em>Summary</em> has this shortcode in it:</p>
  
  <pre><code>[summarypage]
  </code></pre>
  
  <p>The shortcode was added to main plugin file</p>
  
  <pre><code>add_shortcode( 'mainpage', 'mainPage' );
  add_shortcode( 'summarypage', 'summaryPage' );
  </code></pre>
  
  <p>Now, in my plugin directory, I have two PHP files named <code>mainpage.php</code> and <code>summarypage.php</code>, and they return HTML content.</p>
  
  <p>In mainpage.php</p>
  
  <pre><code>function mainPage() {
      // Code which generates HTML content
      $mainpage .= 'content';
      return $mainpage;
  }
  </code></pre>
  
  <p>Similarly, in summarypage.php</p>
  
  <pre><code>function summaryPage() {
      // Code which generates HTML content
      $summarypage .= 'content';
      return $summarypage;
  }
  </code></pre>
  
  <p>Since, $mainpage and $summarypage contains all that which go inside the page textarea box. I have no idea how to add some meta information to my main or summary pages. Using <code>wp_head</code> inside the function <code>mainPage()</code> and <code>summaryPage()</code> doesn't work and rightly so.
  So, how can I get a meta tag inside the head section of the page?</p>