Woocommerce Edit Query

This was my first Woocommerce project and it was rough getting everything working as expected. This bit of code helped me narrow the query results for Woocommerce. Place in functions.php


Register Custom Post Types

I was sick of repeating myself when making CPTs. This is a pretty simple function that makes it easier.

Now this is obviously not a “One Size Fits All” Solution but I find it helpful as a starting point.

Query Custom Post Types

Query WordPress for a particular post type.

If you just want an object and not the entire post loop you can also do this.


Edit Search Query

Used to edit the search query. In this case we are only allowing the search to query for ticket and client post types.