Alternative to do_shortcode( ‘[shortcode] $content [/shortcode]’ )

I found this, that function invokes a fairly large regex every time it is called.

I too found alternative to do_shortcode( ‘[shortcode]’ )

In the article there is the following code:

$old = do_shortcode( '' );
$new = do_single_shortcode( 'gallery', array( 'columns' => 2, 'ids' => '19,20,21,22' ) );

But how to apply it to which uses opening and closing tags [shortcode] [/ shortcode], there is also flanked content?

How change my this code to alternative:

  $my_linkdownload = get_post_meta( get_the_ID(), 'linkdownload', true);
  if( ! empty( $my_linkdownload ) ) {
echo do_shortcode('[pms-restrict subscription_plans="8"] <a href="' . $my_linkdownload . '" target="_blank"><img src=""> </a>[/pms-restrict]');

Read more here: Alternative to do_shortcode( ‘[shortcode] $content [/shortcode]’ )

Leave a Reply

Your email address will not be published. Required fields are marked *