WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
[resolved] WARNING: Creating default object from empty value... Thanks Woothemes, again! (4 posts)

  1. Pocket Flan
    Member
    Posted 9 months ago #

    It's really unbelievable the amount of Woocommerce updates that keep breaking stuff or show new warnings, themes break, codes break here and there, plugins break... it never ends. These guys must be so desperate, it's really embarrassing.

    The following code used to work fine:

    add_action('init', 'PF_renameCategoryTags');
    
    function PF_renameCategoryTags() {
        global $wp_taxonomies;
    
        $cat = $wp_taxonomies['product_cat'];
        $cat->label = 'My Categories'; // breaks in WC 2.1.10
        $cat->labels->singular_name = 'My Category'; // breaks in WC 2.1.10
        $cat->labels->name = $cat->label;
        $cat->labels->menu_name = $cat->label;
    
    }

    After updating Woocommerce to 2.1.10 I received the following warning pointing to the above code:

    Warning: Creating default object from empty value in /home/.../functions.php on line x, y, z

    https://wordpress.org/plugins/woocommerce/

  2. tweakben
    Member
    Posted 9 months ago #

    This is why you test the updates on a non-live server. People never learn.

  3. Mike Jolley
    Member
    Plugin Author

    Posted 8 months ago #

    I've responded here http://wordpress.org/support/topic/warning-creating-default-object-from-empty-value-thanks-woothemes-again-1?replies=2#post-5666434

    In general, hacking WordPress globals is asking for trouble anyway.

  4. Pocket Flan
    Member
    Posted 8 months ago #

    @tweakben, "non-live" servers... you sound like an amateur dude.
    LIVE TEST servers is what I play with. Learn some and never assume again.

    --

    @mikejolley, see my reply: http://wordpress.org/support/topic/warning-creating-default-object-from-empty-value-thanks-woothemes-again-1?replies=2#post-5666434

Reply

You must log in to post.

About this Plugin

About this Topic