alexbaron50
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] Woocommerce 2.1 brokenActually I think it is a WordPress bug, the setup_postdata() function should not trigger the “the_post” action without before triggering all of the previous actions. You can find a list of hooks in this page, http://codex.wordpress.org/Plugin_API/Action_Reference in the order they are supposed to be called.
As you will notice ‘the_post’ action is in 35th position, meaning that all of the functions attached to the previous actions are never called, like the one that is including the functions in Woocommerce.
I guess for this case is easier for WooCommerce to fix this error, but I think they are following the rules of WordPress on where to attach functions to specific hooks.
Forum: Plugins
In reply to: [WooCommerce] Woocommerce 2.1 broken@tenku I did a deeper research and found out that any function that calls the native WordPress function setup_postdata() cause this warnings.
Your problem is on the files of the wp-content folder, DO NOT TOUCH anything on the wp-includes or wp-admin folders.
Unfortunately is quite hard for me to help you, if you send some kind of contact I’ll be glad to help you
Forum: Plugins
In reply to: [WooCommerce] Woocommerce 2.1 broken@heckmedia, let’s say you have something like this in your functions.php file, or any other plugin making this kind of requests with no hook attached:
$query = array('posts_per_page' => 11); $results = new WP_Query($query); while($results->have_posts()){ $results->the_post();//This is the line causing the warnings }It should be like this:
function myQuery(){ $query = array('posts_per_page' => 11); $results = new WP_Query($query); while($results->have_posts()){ $results->the_post();//This line wont' cause the warnings anymor } } add_action('init', 'myQuery');Forum: Plugins
In reply to: [WooCommerce] Woocommerce 2.1 brokenI just got this problem and I solved myself,
What was happening is that I was calling the “the_post()” from a WP_QUery object on a function attached at the very beginning, therefore the wc_setup_product_data function or neither of the functions defined on the woocommerce file “includes/wc-template-functions.php” was yet initialized as they are not included until “the_post” hook.
Just attach the function or portion of code that is calling the “the_post()” to the “init” hook.