Maybe there is a better solution, but serialize seems to do the job.
Instead of json I could pass json_decoded and then serialized parameters.
For example
$jsonval = json_decode('{"foo": "bar"}');
$serialized = serialize($jsonval);
Shortcode will be something like:
[myshortcode parameters="O:8:"stdClass":1:{s:8:"foo";s:3:"bar";}"]
At this point I can handle parameters unserializing them:
function myshortcodehandler($atts){
$arrparameters = (array) unserialize($atts["parameters"]);
...
Seems to work also with array in json.
Related Posts:
- How to handle shortcodes when using the JSON API
- Preserve shortcode content formatting
- Gutenberg Block with Select from JSON-File
- WordPress Shortcode / Only works in classic editor, gutenberg error / invalid json response
- WP REST API remove the WordPress shortcodes from the JSON wp/v2/posts content->rendered
- Third-Party API – PHP Fatal Errors Paired with http_request_failed / cURL error 28
- Using get_option() in JavaScript
- Shortcode empty attribute
- Using wp_editor in shortcode
- Why are you using add_action for shortcode?
- How to get URL param to shortcode?
- How to display the site name in a WordPress page, or post
- How can I put a wp_redirect into a shortcode?
- Using audio shortcode for .mp3 URLs with a query string
- Get multiple shortcode attribute values
- Why do_shortcode is not executing the shortcode in data-* html attributes?
- How to display some selected user meta data on a specific page with a shortcode?
- Some doubts about gallery shortcode in WordPress
- has_shortcode for content added after the content
- Shortcode displays only default attribute values
- Creating a Slider Shortcode Based on Nivo Slider
- Passing attributes to shortcode dynamically
- How can I make a shortcode from this code?
- Adding PHP/HTML code inside page from custom template
- WordPress auto adds p to shortcode parameters
- Why isn’t this youtube shortcode working?
- Gist shortcode is not working
- ShortCode and extra
- How to change page title (from a plugin) in twentytwentyone theme
- WordPress Code Standards and Working $link Parameters In Shortcode
- How to set Contact Form 7 fields default value using shortcode attribute? [closed]
- Display post metadata: “title, category, author, date” with shortcode
- shortcode javascript not working on custom template file inside theme folder
- Shortcodes Keep Wrapping in
- Check if post has gallery images/media
- Stop auto formatting in shortcodes
- If you add a shortcode programmatically, but the code isn’t viewed on that request, is it still executed?
- Add shortcode support to custom field
- Shortcode help: If no image entered take default
- How can I escape a section of my page which contains multiple shortcodes?
- Running shortcode with variable that is modified
- shortcode to display post by category entered by user without plugin
- How to change the output of gallery shortcode
- wp_list_pages shortcode jumps above previous content
- Shortcode attributes don’t appear?
- Shortcodes: closing shortcode not being processed
- Using $this from child class inside shortcode function
- Div-Wrap with Functions.php in Childtheme using Shortcode!
- Trying to call dynamic content as a shortcode attribute
- How to trace shortcode to its functionality
- shortcode issue in the_excerpt
- Using shortcodes to communicate my page design
- How to check if a post has any one of many shortcodes?
- enqueue script with get_shortcode_regex
- Run shortcode in custom script in wp_head if post type is CPT ‘Jobs’
- Use Contact Form 7 with Ajax
- Is it possible to add a shortcode’s content to a table?
- How to set a variable in a shortcode and reference it in another shortcode in the same post?
- How to get_post_meta in a shortcode in excerpt on archive pages
- Which file renders the “Edit Gallery” Settings page?
- using shortcodes in theme content
- How to: Simple Nested Shortcode [closed]
- Plugin renders in preview but shortcode shows when published
- How to process shortcode on post save and update only
- How to turn this HTML code into a shortcode? (adding song lyrics and giving an id to a div)
- ACF repeater + group shortcode
- Custom shortcode skips every 2nd shortcode
- my form does not insert any data in the database
- Global $post returns 2 objects for my shortcode
- Gutenberg Shortcode Chooser Block
- Hide download option video shortcode
- WordPress Shorcode Display hierarchical taxonomy [child, parent]
- Shortcode not working in Jetpack Top Posts & Pages widget
- Restricting shortcode for users
- Gutenberg running code only available in front end within shortcode
- Insert HTML in content property and render it using shortcodes
- Redirect per shortcode if user is logged in
- Shortcode, vs blocks, vs templates – what would you do for choosing or creating custom post data in editor?
- create shortcode that changes url endpoint
- Convert WordPress shortcodes into plain html
- Attributes are not passed on nested shortcode
- How to make a shortcode with a line break in it parse correctly?
- Removing text + shortcode from all posts
- Plugin Shortcode value in post
- Woocommerce Filter Main Loop by Tag [closed]
- Shortcodes: override a shortcode / change shortcode on the fly
- Access the resized images generated by `add_image_size()`
- Class variables in shortcodes
- Defining the output of a WordPress Att
- Custom WP theme not showing shortcodes
- Shortcode for sectors
- woocommerce Product shortcode create [closed]
- A number appears inside a div called wpb_wrapper, when I use a custom shortcode
- Enclose article’s body with default shortcode
- Why is my ajax live search not working when i use a shortcode to call it?
- Shortcode with foreach
- WordPress shortcode select option not working [closed]
- Working with Shortcode, AJAX, Elementor
- How to exclude some cats from wp_list_categories using shortcut
- How can I create a shortcode that shows a list of categories on the single product page?