MSQL, mysql, SQL, WordPress
To remove all custom post, you can use the fallowing PHP script in your uninstall.php file or function/method defined in your plugin. For example, let’s pretend we are uninstalling a book custom post type plugin: $books = get_posts([‘post_type’ =>...
MSQL, mysql, SQL, WordPress
Tags and Categories are not related to each other. They both tied to posts, so that we need to query for all the posts/products assigned to the top level category. First, We need to recursively query for ID of categories that points to our initial category and every...
MSQL, mysql, SQL, WordPress
WordPress query non-empty tags or categories. Query only tags/categories that are assigned to a product. If you need to query tags or categories not particularly related to any tag category or product. You can go ahead and query data directly from two tables: wp_term...
MSQL, mysql, SQL, WordPress
WordPress SQL – List all child categories of specific parent category ID If you need to list all categories listed under a specific parent category, you can run recursive SQL query. See the example below: SET @parentCategoryId := 17; — <<< parent post...
MSQL, mysql, SQL, WordPress
WooCommerce SQL – List children category of specific category id If you need to list all categories listed under a specific parent category, you can run recursive SQL query. See the example below: SET @parentCategoryId := 17; — <<< parent post ID...