JavaScript for WordPress Forums Gutenberg Development Getting Taxonomy Selection to Work on Custom Post Feed

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #60844


    I’m currently developing a post feed block that works with custom post types and taxonomies to display a post feed. I can get my custom post type to display in the editor and the taxonomies to appear in the category selector. However, if I select a taxonomy the post list in the editor does not change, which tells me it’s something with latestPostsQuery in the edit.js file. I’ve tried many combinations of query modifications but haven’t had any luck.

    I tried reaching out on the core editor slack, searched through Gutenberg Github, and have done a lot of googling without any luck. If anyone has any helpful information that could point out what I’m doing incorrectly I would be very grateful.

    Here is my working files for this block, it’s based on the Latest Posts block.
    CPT Post Feed Working Files


    Zac Gordon

    I took a quick look at the code, but on the event handler for handling the selection of checkboxes can you at least get something to trigger so you know that part is working. For example log out what the new request is along with the modified query results.

    Also can you mock it up to give you a custom query from the start by hardcoding it like one of the custom taxonomies have been selected.

    Just thinking of a few ways to begin troubleshooting.



    Thank you for the advice. Luckily all of the toggles and control panel settings worked perfectly before hand. So, I took your advice in a little bit different direction to try and narrow down what I could change in the query versus what didn’t work. I searched through the Gutenberg repo and didn’t find too many helpful bits that actually altered the query which led me to ask where the query keys and terms originated from. Long story short the answer involved referring to the Rest API Documentation.

    When I looked at the term categories in the document it said “The terms assigned to the object in the category taxonomy”. I then added hms_event_types: categories to change the endpoint to match my taxonomy. Everything worked like a charm after that. The categories constant returns an integer for the post id which fixed the post query displayed in the editor.

    Just wanted to share this bit of information in hopes that it might help save time.

    Here is the updated version of my block
    Event Custom Post Feed Block

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.