WordPress.org

Forums

My Shortcodes
[resolved] Problems after upgrade - warning in shortcode preview (6 posts)

  1. James
    Member
    Posted 1 year ago #

    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

    http://wordpress.org/extend/plugins/my-shortcodes/

  2. David Cramer
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. James
    Member
    Posted 1 year ago #

    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

  4. David Cramer
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  5. James
    Member
    Posted 1 year ago #

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

    :)

  6. David Cramer
    Member
    Plugin Author

    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • My Shortcodes
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic