Adding to the_content or a variable from within a shortcode function

I think, I would simply store all the definitions during the glossary_shortcode() execution in a global variable and serve them at the end of some hook like the_content. function glossary_shortcode( $atts = array(), $shortcode_content = null ) { // Your code can be kept identical, just store the $glossary_term_object somewhere. global $glossaries; $glossaries = $glossaries … Read more

Where to filter Shortcode string prior to execution

shortcode_atts_{$shortcode} seems to be the WordPress filter you need. https://developer.wordpress.org/reference/hooks/shortcode_atts_shortcode/ It is used in the shortcode_atts() function: https://developer.wordpress.org/reference/functions/shortcode_atts/

Use shortcodes in terms description? [closed]

I believe the following should work: <?php $content = apply_filters(‘the_content’, $content); $content = str_replace(‘]]>’, ‘]]&gt;’, $content); ?> You could put this in the template of in a hooked functions. I’ve cribbed this from here and here, where the intention is to write content from get_the_content() (raw) in an equivalent way to the_content() (amongst other things: … Read more

Shortcodes attributes defaults

I have no idea what goes wrong at your setup. Clearly shortcode is properly registered, but some specific case something prevents it from being parsed correctly. This is test code that roughly replicates how shortcode is parsed for execution : $content = get_option(“prc_speciall_offer_text”, true); $pattern = “https://wordpress.stackexchange.com/”.get_shortcode_regex().’/s’; preg_replace_callback( $pattern, ‘var_dump’, $content ); Array output should … Read more