Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • Alessandro Magnetti
    Participant

    Hello,

    We use shortcoder pro in a multisite where we have defined on the site with the ID 1 some shortcodes containing SQL expressions. Then in function.php we have defined a function to execute that queries from any other site in this way:

    
    add_filter( 'do_shortcode_tag','pre_query_mssql_execute',10,3);
    
    function pre_query_mssql_execute($output, $tag, $attr)
    {
        if (isset($attr['name']))
            phpAlert('Attr name: ' .$attr['name']);
    
        if (isset($attr['name']) && strpos($attr['name'], 'query_mssql') !== false)    {
            switch_to_blog(1);
    	$shortcodes = Shortcoder::get_shortcodes();
    	$shortcode_content = $shortcodes[strtolower($attr['name'])]["content"];	
            $output = query_mssql_execute($shortcode_content,$attr);
            restore_current_blog();
        }
        return $output;
    }
    

    It works but we lose some pretty feature like finding the shortcode around and the integration with WP Bakery page builder from sites with ID != 1.
    Have you any plan to implement a feature like “site from where grab the list of shortcode” ?

    Thank you.

    A.

    Hi Alessandro,

    Thanks for using Shortcoder PRO.

    As of now the plugin does not support multisite and there are no plans either.

    Since most users are single site owners, the plugin did not focus multisites.
    Also, there are users with thousands of shortcodes. Since the preference is to keep the plugin lightweight, fast and simple features which are very specific/heavy are not implemented.

    w.r.t your requirement, I can include wordpress hooks wherever needed to introduce customization. You can later use those hooks for multisite features like above. Please do let me know further on this.

    Thanks,
    Aakash

    lnki5538
    Participant

    Hello Aakash,

    I’d like to suggest two specific hooks that could greatly enhance the plugin’s utility in our scenario:

    1. A hook immediately after pressing “Locate this shortcode”: By having a hook right after the shortcode is located, it would allow for more dynamic interaction with the shortcode, especially in cases where shortcodes are defined on a different site within the network.

    2. A hook when pressing the blue [/] “Insert shortcode to editor” button: This is crucial for our use case. If this hook is available, it would enable us to programmatically execute switch_to_blog(1); and subsequently restore_current_blog();. This functionality would allow us to seamlessly integrate shortcodes from the main site (site with ID 1) into our other sites within the multisite network, without losing the integration with WP Bakery page builder or other features.

    Thank you for considering these suggestions.

    Hi @lnki5538,

    Sorry for the delay. Yes that would be possible. I’ll look through the code and confirm if I can add it in the next version of the plugin.

    Thanks,
    Aakash

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Subscribe for updates

Get updates on the WordPress plugins, tips and tricks to enhance your WordPress experience. No spam. View newsletter