I have a wordpress shortcode which contains some other shortcodes inside it. When the first shortcode is executed i want to filter out other shortcodes using a regex.
[main_code]
[sub_code id='testid']test content[/sub_code]
[sub_code id='testid' name='testname']test content[/sub_code]
[/main_code]
When i execute the main_code i want to filter the sub_code into an array and access its attributes without executing sub_code as a shortcode.
Anyone who has knowledge to give me a solution is highly appriciated.
If you want to match the inner parts, then I'd advise:
The
[^\[\]]
matches any content without square brackets. So it's ensured no other shortcodes can exist within.