Skip to content
Advertisement

Tag: wordpress

WordPress delete posts not in specific categories using wpdb query

How do I modify the following query to delete all posts with the custom post type “listings” that are NOT IN specific Wordpress categories? Note, I must use $wpdb->query() in my particular situation. My categories for exclusion are term ID’s 21, 22, and 24. UPDATE – THIS query brings me a lot closer to what I am after but throws

Sort Orders IDs alphabetically based on the shipping last name in Woocommerce

I need to sort my $order_name (more specifically $order_shipping_last_name) alphabetically. I’ve tried many different basic php sort() methods, in many different places, and can’t get this to work. I’m assuming I’m missing something? In my code, get_all_orders_that_have_a_product_variation( $product_id ); function comes from this answer code that allow to get an array of orders IDs from a variation ID… The list

where does woocommerce store orders?

I’m looking in the sql db and I can see something that resembles orders inside wp_posts . However, I would expect them to be inside the tables beginning with wp_woocommerce. Can anyone shed some light on this phenomenon? Cheers Answer In woocommerce orders are modelled as a custom post type so they are stored in wp_posts as you found. See

Advertisement