admin管理员组

文章数量:1122832

I’ve got a shortcode plugin which allows me to output a block of HTML in one of a few different formats based on parameters.

[mm-postlinking]
[mm-postlinking id="281493" template="thumbnail"]
[mm-postlinking template="link" link_text="View page"]
etc.

Currently all of the formats are visual, but I’m wondering if I can return a data object or associative array from the plugin instead of markup. Basically I have an area of my site that could use the data being generated by this plugin, but has it’s own layout. So it would be great if I could call the plugin (or code within the plugin), directly and get just the data back.

If it matters, the plugin code is class based. I'm on WordPress 6.4.4 and I'm explicitly not using Gutenberg (if that matters).

本文标签: plugin developmentShortcode to return data instead of outputting HTML