title: How to use a shortcode of a plugin in another plugin php file
body: <p>I'm trying to implement reservation function in my web with two plugins of wordpress.</p>
  
  <p>Two plugins are reservation plugin and payment plugin, respectively.</p>
  
  <p>Reservation plugin has some steps for reservation, for example, selecting service, choosing the date, time, etcs.</p>
  
  <p>I want to insert a "payment button" provided by payment plugin in payment step of reservation plugin.</p>
  
  <p>I wrote down below code in php file(for payment step) of reservation plugin,</p>
  
  <pre><code>    &lt;?php
  
       if ( shortcode_exists( 'payment_button' ) ) {
  
       echo nl2br("Payment plugin shortcode exists!\n");
       echo do_shortcode( '[payment_button]' );
  
      } 
       else {
        echo nl2br("No payment plugin shortcode exists!\n");
    }
  
   ?&gt;
  </code></pre>
  
  <p>With the above code, "Payment plugin shortcode exists!" is printed out but I can't get payment button of payment plugin in my web.</p>
  
  <p>Wordpress built-in shortcode like [gallery] has worked, which I did as a test.</p>
  
  <pre><code>&lt;?php echo do_shortcode( '[galley]' ); ?&gt;
  </code></pre>
  
  <p>What should I check about two plugins or anything else?</p>
  
  <p>Loading order of two plugins?</p>
  
  <p>Enquescripts order of scripts used in two plugins?</p>
  
  <p>I tried to load reservation plugin later than payment plugin, with adding the below code to main php file of reservation plugin , but this did not work.
  (reference: <a href="https://gist.github.com/bappi-d-great/26808240df88dd1fc3fe" rel="nofollow noreferrer">https://gist.github.com/bappi-d-great/26808240df88dd1fc3fe</a>)</p>
  
  <pre><code>    &lt;?php
  /*
  *
  * Use the code at the beginning of a plugin that you want to be laoded at last 
  *
  */
  function this_plugin_last() {
      $wp_path_to_this_file = preg_replace('/(.*)plugins\/(.*)$/', 
  WP_PLUGIN_DIR."/$2", __FILE__);
      $this_plugin = plugin_basename(trim($wp_path_to_this_file));
      $active_plugins = get_option('active_plugins');
      $this_plugin_key = array_search($this_plugin, $active_plugins);
          array_splice($active_plugins, $this_plugin_key, 1);
          array_push($active_plugins, $this_plugin);
          update_option('active_plugins', $active_plugins);
  }
  add_action("activated_plugin", "this_plugin_last");
  </code></pre>
  
  <p>A little advice about my problem would be helpful to me.</p>