Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • K4
    Participant

    A while back prior to WP 5.2 we used to be able to modify your plug-in so that it was global in scope. Global meaning that a change in any site would affect the entire multi-site. We did this by making a small change replacing “get_option” with “get_site_option” and “update_option” with “update_site_option” as shown below from these two methods in the shortcoder.php file:

    `public static function list_all(){

    $shortcodes = get_site_option( ‘shortcoder_data’ );

    return empty( $shortcodes ) ? array() : $shortcodes;

    }`

    `public static function on_activate(){

    $shortcodes = self::list_all();
    $sc_flags = get_site_option( ‘shortcoder_flags’ );

    // Move the flag version fix to sc_flags option
    if( isset( $shortcodes[ ‘_version_fix’ ] ) ){
    unset( $shortcodes[‘_version_fix’] );
    update_site_option( ‘shortcoder_data’, $shortcodes );
    }

    $sc_flags[ ‘version’ ] = SC_VERSION;
    update_site_option( ‘shortcoder_flags’, $sc_flags );

    }`

    This worked up to the WP 5.2 update and then stopped working. The ability to use your Shortcoder plugin globally for our multi-site was amazing and saved us a lot of time exporting and importing Shortcoder files to all our sites. I’m not sure what in the 5.2 update broke this functionality but assuming that it works again it would really be awesome if you could adjust these two methods so that they could either save on a per site basis (like it is currently) but also add a global (across entire multi-site) option as well. Having this as a setting for Shorcoder would greatly help us.

    Thank you for your consideration,

    K4

    Hi K4,

    v5+ is rewritten from scratch using WordPress’s custom post type feature.

    There was a limitation in v4.x on how big shortcode content can be. To address that the plugin has to be rewritten.

    The get_site_option won’t work with v5 as those APIs are not used anymore.

    For now you can move back to v4.6 and use your changes. https://wordpress.org/plugins/shortcoder/advanced/

    I’ll let you know if multi-site shortcode is possible in v5.

    Thanks,
    Aakash

Viewing 2 posts - 1 through 2 (of 2 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