How to list all categories and their IDs using SQL query?

I am looking for a SQL Query that can give the list of all categories created in WordPress Site along with it’s category IDs. Please advise a query to get it as category/term relationship is quite complex in WordPress.

I got this but didn’t work –

SELECT ID,post_title FROM wp_posts INNER JOIN wp_term_relationships ON wp_term_relationships.object_id=wp_posts.ID INNER JOIN wp_term_taxonomy ON wp_term_taxonomy.term_taxonomy_id=wp_term_relationships.term_taxonomy_id INNER JOIN wp_terms ON wp_terms.term_id=wp_term_taxonomy.term_id WHERE name='category' 

How to display the categories on page using shortcode?

I am trying to display the categories name on my page but it’s not displaying. I am using the below code and I added the shortcode gridCategories on my page. I am getting only array

function createGridCategories(){ $  categories = get_categories( array(     'taxonomy'   => 'category',     'orderby'    => 'name',     'parent'     => 0,     'hide_empty' => 0, // change to 1 to hide categores not having a single post ) ); var_dump($  categories); return $  categories; } add_shortcode( 'gridCategories', 'createGridCategories'); 

I tried this also

$  categories = get_the_category(); var_dump($  categories); 

I added a shortcode like this in textblock

enter image description here But still, I am not getting any output on my page. Is there any issue with my code?

How to target all woocommerce categories that don’t have any subcategories in them?

I want to target all pages (product categories) that are displaying the products themselves.

My woocommerce settings set to show only categories/subcategories (unless there are none) and then by default the products grid is displayed on the page.

is_product_category() function doesn’t help since it also targets the parent categories which don’t have direct products in them.

Most of my categories that don’t any subcategories in them are grandchildren categories if it matters for the answer.

How can I achieve it and to use it in woocommerce hooks?

Woocommerce Show categories under product title in products list

I want to know how can I have the products listed showing with the following information:

  • Image
  • Price
  • Category
  • Product Title

Here is an example:

enter image description here

I was trying to use a hook like this in functions.php without success:

add_action( 'woocommerce_shop_loop_item_category', 'woocommerce_template_loop_product_category', 10 ); 

What range categories exist for spells?

The SRD gives us a helpful list of possible ranges for spells: Personal, Touch, Close, Medium, Long, Unlimited, and Range Expressed in Feet. However, this is clearly not a comprehensive list of all of the possible range categories in the game. For example, Persistent Spell’s text claims that “Spells with a fixed or personal range can have their duration increased to 24 hours”. This is despite, to my knowledge, “fixed range” not being a term that is defined in game or obviously understandable in plain English (e.g. this question shows one potential source of confusion).

This leads me to my question: What range categories does the game acknowledge, what are their definitions, and where are these definitions found or derived from?

Get categories within specific term

I have a WooCommerce shop, where I’d like to show every possible product category, where the products have a specific attribute (term). Say I have a product attribute called: “Designer”, then I wish to find all the categories where products have attribute Designer => “Nike”.

So essentially the output would be:

Nike categories:

  • Shoes
  • Hats
  • Pants

Any pointers in the right direction where I can solve this?

How to get all posts from parent and children categories?

I am trying to get all posts from category products. My template looks like this: /products/PARENT_CATEGORY/CHILD_CATEGORY. What I need is all the posts from every CHILD_CATEGORY.

I try to access it via /posts?categories=28, but it returns no posts, as the category with ID of 28 doesn’t have any posts itself. But its child, for example, category with ID of 40, has some posts. Should I access them like /posts?categories=40,41,42...? Or there is another way to do it?

Plugin/template to distribute images into different pre-existing categories?

I’m working on an interface that needs to enable the user to upload 15-200 images and then distribute the images into different categories. The images will be fairly sequential; i.e. images 1-3 go into category A, 4-10 into category B, image 11 into category C, images 12-40 into category D, etc.

Some categories are mandatory and some are optional.

Any recommendations for existing plugins or templates for this functionality?