Skip to content

Software Development at Program Tom LTD

Place for coding, programming, development and software in general.

Menu
  • Blog
  • PDF Booklets
  • Dev Utils & Content
  • Java Spring Boot Or Web Apps
  • English
    • български
    • English
    • Español
    • Português
    • हिन्दी
    • Русский
    • Deutsch
    • Français
    • Italiano
    • العربية
  • About Us
Menu
WordPress JSON Categories

How to grab WordPress Categories and show them in Flutter Web

Posted on January 14, 2021January 21, 2021 by Toma Velev

I’ll continue my previous post about Consuming WordPress JSON API and Tags by showing you how to Grab the Categories and their related Posts or Products from the JSON API of a WordPress Web Site.

Load Post Categories

The Post Categories list endpoint is located under the address https://<wp>/wp-json/wp/v2/categories[?parent=<id>]. It has the following JSON Model:
WordPress Product tags

The [?parent=<id>] part of the URL is optional. If it is present you’ll get a filtered result – only the children of some parent category or all categories otherwise. The fields of the category data model are:

  • id : Integer
  • name: String – populated in the WordPress Admin Interface
  • description: String – populated in the WordPress Admin Interface
  • slug: String – URL friendly String of the category (again open for modification by the admin).
  • count: the number of products that have the category.
  • parent: Integer – the ID of the parent category or 0(zero) if it does not have a parent

To Filter Posts by Category, you must hit the following URL: https://<wp>/wp-json/wp/v2/posts?categories=<id>.

To demonstrate the Blog Posts Categories I’ve created a Flutter Web Application that loads them from this website: https://programtom.com/dev_examples/wp_categories/posts/. More complete display of information will be extended with the inclusion of other WordPress Data Models.

Load Product Categories

The Product Categories are located on the following sub-address: https://<wp>/wp-json/wc/store/products/categories

WordPress Product Categories

  • id : Integer
  • name: String – populated in the WordPress Admin Interface
  • description: String – populated in the WordPress Admin Interface
  • slug: String – URL friendly String of the category (again open for modification by the admin).
  • count: the number of products that have the category.
  • parent: Integer – the ID of the parent category or 0(zero) if it does not have a parent
  • review_count: Integer – products are also able to have reviews by other users
  • permalink: String – the URL of slug Product Category – formed by concatenating the slug with “https://<wp>/product-category/<slug>/<slug1>”. If there is a parent the slug is the slug of the parent and the slug1 is the current. Otherwise the slug1 is missing. All this monkey business is because of Search Engine Optimization.
  • It has an Image Sub-Object with the following properties as (probably) most important
    • src – the source of the original (best) quality
    • thumbnail – a less good version of the image, but appropriate in many places where the best quality is not required

To Filter Products by certain Category you could hit the following URL: https://<wp>/wp-json/wc/store/products?category=<id>

To demonstrate the Blog Posts Categories I’ve created a Flutter Web Application that loads the categories from this website: https://programtom.com/dev_examples/wp_categories/products.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Prompt-to-Production: How AI is Forcing Us to Build Higher Quality Software
  • Debug Web View Flutter App
  • Skipping AI? You’re a Relic – Time to Evolve or Perish!
  • 2026 Flutter Launch Blueprint: Your 10-Step Checklist to App Store Domination
  • Product Requirements Document – for different software development levels

Categories

  • Apps (25)
  • ChatGPT (27)
  • Choosing a Framework (38)
  • Flutter (281)
  • Graphical User Interface (14)
  • Marketing (119)
  • Software Development (292)
  • Spring (45)
  • StartUp (22)
  • Uncategorized (14)
  • Uncategorized (4)
  • Vaadin (16)

Tags

Algorithms (9) crypto (29) flutterdev (39) General (86) Java (7) QR & Bar Codes (3) Software Dev Choices (33) Spring Boot (1) standards (1) Theme (3) User Authentication & Authorization (9) User Experience (10) Utilities (19) WordPress (11)

Product categories

  • All Technologies (87)
    • Flutter Apps (26)
    • GPT (4)
    • Java (39)
    • Native Android (3)
    • PHP (9)
    • Spring (Boot) / Quarkus (36)
    • Utils (15)
    • Vaadin 24+ (28)
    • Vaadin 8 (1)
  • Apps (18)
    • Employees DB (1)
    • Notes (6)
    • Personal Budget (1)
    • Recipes Book (1)
    • Stuff Organizer (1)
    • To-Do (2)
  • PDF Books (3)
  • Source Code Generators (8)

Recent Posts

  • Prompt-to-Production: How AI is Forcing Us to Build Higher Quality Software
  • Debug Web View Flutter App
  • Skipping AI? You’re a Relic – Time to Evolve or Perish!
  • 2026 Flutter Launch Blueprint: Your 10-Step Checklist to App Store Domination
  • Product Requirements Document – for different software development levels

Post Categories

  • Apps (25)
  • ChatGPT (27)
  • Choosing a Framework (38)
  • Flutter (281)
  • Graphical User Interface (14)
  • Marketing (119)
  • Software Development (292)
  • Spring (45)
  • StartUp (22)
  • Uncategorized (14)
  • Uncategorized (4)
  • Vaadin (16)