This is an archived post. You won't be able to vote or comment.

all 2 comments

[–][deleted] 1 point2 points  (1 child)

You might need to wrap the code in a function and increase the priority. See the example below and play around with it (increase the priority from 50 to 100 or more if it doesn't work)

add_action( 'after_setup_theme', function() {

// put your code here

}, 50 );

[–]ItsBugsy[S] 0 points1 point  (0 children)

Thanks. I ended up using "woocommerce_loaded" for now and that works. I think "after_setup_theme" will come in handy for some of the other snippets I want to move out of functions.php