• Resolved James

    (@en7jos)


    Hi,

    I’ve just upgraded to v2.0 of the plugin and am seeing error messages in the shortcode preview (“result”) window. Everything was running fine with the old version, and this new version seems to work fine on the frontend, but just shows this error in the admin.

    The error look something like this:
    “Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘woocommerce_demo_store’ not found or invalid function name in /home/mysite/public_html/wp-includes/plugin.php on line 406”

    The same error message is shown below the preview of the shortcode (which looks fine) for all of the shortcodes I had created with the previous version of the plugin. I’ve also just tried to create a new shortcode and the same message is displayed in the preview pane even before any details are entered for the new element.

    Suggestions please!

    Thanks, James

    https://www.ads-software.com/extend/plugins/my-shortcodes/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author David Cramer

    (@desertsnowman)

    ah yes woocommerce. They have a hook in the system that get in very early.
    For me to get the preview to show without loading the site, I need hook in just before rendering the page, then load my own page.

    This works 99% of the time, but for woo-commerce, they hook in way before that on the call, but hook the actual library way later. the result is the function is called but the library hasn’t loaded.

    This is not bad on weecommerce development nor on mine, its just a situation that can’t be avoided.

    However. I can make something to detect the hook for woocommerce on the preview and disable it for that view. I feel this may be ahack though.

    I’ll look into finding a real fix for it.

    For now, try adding in the php tab: if(!function_exists(‘woocommerce_demo_store’)){
    function woocommerce_demo_store(){}
    }

    yup, very hacky but it might work for now.

    Thread Starter James

    (@en7jos)

    Hi and thanks for your prompt response.

    If it’s just a matter of the preview not looking so pretty, then I’m not too bothered really (although it would be better if you could hide the error in some way so as not to raise questions!). I was more concerned whether it was something more fundamental broken with the plugin, WooCommerce of WP.

    I’m happy to leave it as is with the error showing in the plugin for the moment given your explanation that it’s nothing important. But will look forward to a future update when you find a nice clean solution!

    Cheers, and thanks for a very useful plugin!
    James

    Plugin Author David Cramer

    (@desertsnowman)

    well it almost 9 hours late, so it was not that prompt.

    No its not fundamental problem, just one of those things were two plugins work in the same area. If anything, it more due to the way I intercept the load. It’s not the best way to do it but, I require the themes function file to be loaded in the event your shortcode uses a function in the theme. I’m sure I’ll find a solution.

    I’m glad that you like the plugin, and if there are any other problem, don’t hesitate to let me know.

    Thread Starter James

    (@en7jos)

    Nine hours late? Still waiting for responses from author plugin authors weeks or months later! Within 24 hours is just fine thanks.

    ??

    Plugin Author David Cramer

    (@desertsnowman)

    Ah! now I know I can slack off at time. Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Problems after upgrade – warning in shortcode preview’ is closed to new replies.