WordPress.org

Make WordPress Core

Opened 7 weeks ago

#47984 new feature request

Filter pre_do_shortcode

Reported by: miyarakira Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Shortcodes Keywords: has-patch
Focuses: Cc:
PR Number:

Description

I have some situations where an ability to override the shortcode parse/render logic would be very useful. I've prepared and will attach a draft version patch.

An example to demonstrate its need for my use case: currently, the $content is first processed by do_shortcodes_in_html_tags, then the rest of the text. This is problematic for some nested shortcodes where the "parent" shortcode provides a context for its "child" shortcodes - if any of the latter are in an HTML attribute, they're rendered before the parent shortcode is passed its inner content. I'd like a filter to handle it so that parent and child shortcodes are rendered in the expected order.

Another point in favor of this filter is that it would be useful to hook onto all places where shortcodes are being rendered outside the_content, for example, inside a rich text editor field.

I modelled the patch after the pre_do_shortcode_tag.

Attachments (1)

pre_do_shortcodes.diff (1.0 KB) - added by miyarakira 7 weeks ago.
Draft version of proposed patch

Download all attachments as: .zip

Change History (1)

@miyarakira
7 weeks ago

Draft version of proposed patch

Note: See TracTickets for help on using tickets.