Reputation: 465
I have a shortcode
[my_shortcode param1="Parameter 1"]The content here adds
br tag here and converts my quotes 'like this' to html
but does not touch double quotes "somehow"[/my_shortcode]
I would like to get the content of my shortcode as is, without br tags, p tags and html entity converted single quotes or some other surprises.
Is there a way to get the shortcode content as is?
Thank you in advance...
Upvotes: 0
Views: 99
Reputation: 2828
If you mean that you want the parsed shortcode:
$content = do_shortcode('[my_shortcode]foobar[/my_shortcode]');
To get the content "as is" you would need to reverse engineer how WordPress does the conversions. Usually for WYSIWYG content WordPress runs the content through a few functions: wpautop
and wp_texturize
. wpautop
adds p-tags and wp_texturize
does general cleanups and character conversions.
Take a look at those functions and see how you could reverse the things they do. One would be to just use strip_tags()
and html_entity_decode()
for the smallest effort.
Upvotes: 1