Hi,
I am here for specific request to handle REST API JSON response having shortcode like below.
"acf": {
"components": false,
"shortcode": "[xyz-shortcode slug=\"utoo\"]"
},
Now I am able to handle short code data using below code.
add_shortcode('xyz-shortcode', array($this,'getXYZBlock'));
function getXYZBlock($attr)
{
return 'TEST DATA PRINT';
}
It will result
"acf": {
"components": false,
"shortcode": "TEST DATA PRINT"
},
BUT I need to return json data into that function like below where I an having difficulty.
add_shortcode('xyz-shortcode', array($this,'getXYZBlock'));
function getXYZBlock($attr)
{
$array=array();
$array['code']='ok';
return $array;
}
SO I need output like
"acf": {
"components": false,
"shortcode": { "code" : "ok" }
},
How can I do that can any one help me.
Thank You for your support.