Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Deekshith's avatar

How to fetch all shotcodes present in wordpress post

i am using laravel corcel to fetch all the posts and it is working fine.

I have a quiz inside the post as well and I am using wp pro quiz plugin for quiz now I have studied the db structure of wp pro quiz and now I want to fetch the shortcodes which are present in the post using that I will get a quiz id and using quiz id i will fetch the question.

Example:

if post content is,

<p>Instruction goes here</p>

[WpProQuiz 22840]

Now I want to fetch the number after [WpProQuiz and store it in the array. here 22840 is the quiz id.

each post may have more than one shortcode like below,

<p>Instruction goes here</p>

[WpProQuiz 22840]
[WpProQuiz 22841]

Now my result would be like below,

[22840,22841]

Any idea on how to do this?

i will use this array and fetch the questions and write own query in laravel.

0 likes
0 replies

Please or to participate in this conversation.