Functions like get_cat_ID
and get_category_by_slug
only work for core post categories (taxonomy category
) – you are dealing with a custom taxonomy todocategories
.
I see you have $a2zq3_cat_name="Category-name";
hardcoded near the top, so I assume you’re not assigning the todocategories
from POST data.
In which case just use wp_set_object_terms()
like so.
wp_set_object_terms( $a2z3_entry_post_id, [ 'the-category-slug' ], 'todocategories' );
… where the-category-slug
is the slug of the todo category you’re trying to assign.
Always make sure to check the documentation for WordPress functions before you try using them.
Related Posts:
- WordPress JSON API remove posts from a specific category
- Redirect to another page using contact form 7? [closed]
- Including content from legacy app: via plugin or custom content?
- Custom Post Type same name as Category
- How to display the category name in the tab and post inside the tab in WordPress?
- Adding custom post category to categories widget
- Custom Post Type with Sequence ID
- Synch Custom Post Types (and Custom Fields, Cats, etc.) Between WordPress Sites
- How to check if the post exists in any of the categories?
- wordpress reusable content blocks
- Override plugin with functions.php
- Should i delete the posts created by a plugin on uninstall?
- Show Heirachy of categories in WP Download Monitor
- Allow users mark posts as “complete”?
- Custom Post Type Plugin not loading category template and loading 404 instead
- Best way to hook a custom url?
- Is there a way to order posts and custom post types as one group?
- Display content from custom post type if match to main post category
- RW Meta Box ,Problem setting post title
- How can i list random post from multiple category?
- How does WP handle multiple matching rewrite rules?
- how do i remove posts from a WP_Query so the pagination is right?
- Saving Custom Post types and fields to a custom table
- How can I add an options page for my class based plugin?
- Sending WP posts to external API
- dynamically generating plugin syntax
- Is it possible to use WordPress as an online portfolio for text content? What kind of theme would I look for?
- Building a store locator with google maps
- My Category is too big on the Menu what can i do?
- Getting a List of Categories for Use in a Plugin?
- Duplicate posts when posting nulls in records in phpMyAdmin [closed]
- Not able to open category post [closed]
- How to make wp_enqueue_style and wp_enqueue_script work only on custom post type
- Loco Translate: Custom Post and Custom Taxonomy Labels not translated in wp-admin menu
- Accessing post’s meta data based on user’s click of a post
- WordPress category add image field
- CMB2 Repeatable Group & JSON API
- How do I create a custom add media button modal?
- How to create user groups and allow custom posts and plugin modify/access to specific group?
- Easy Digital Download Sub category
- Correct way to make meta box with more than one meta field secure
- I want to extend the current themes’ single.php to display the meta fields of my CPT
- Plugin custom post type – Internal server Error
- Exclude post by custom meta with pre_get_posts
- Solutions to repost categories into multisite blogs?
- How can I create a custom shortcode that will return a custom post type by ID?
- How to access data in wordpress database externally using php
- How to display only subcategory
- Category’s Description field as editor remove tag
- Is it possible to create Custom Post plug-in?
- get_post_type() and WP_QUERY issue
- Assign post format to categories
- Using WP Category Lists Plugin to Dynamically Display Category (PHP)
- Calendar Solution: Handling upcoming Dates with Posts?
- get_post_type on post.php
- Events Plugin that works with existing categories?
- Excluding a category from wp_query breaks recent post widget
- List taxonomy terms for post as checkboxes
- All of my custom posttypes are 404’ing
- more types plugin – display all post of post type on page
- When using Simple Fields plugin, how do I pull the information out of the database to display on a page?
- Trouble with editing template for “List category posts” plugin
- Any built-in function to associate a post to category through a plugin?
- How to make a proper custom post type link
- Matching Chapters to a Custom posts [closed]
- Custom post type – no layout section of Document tab, and no author choice
- Creating a custom post type, adding custom meta fields, preventing all future editability of posts of this type
- ‘No Results Found’ on single post for custom post type
- Keep a post copy when this one is updated – issue
- How to modify WCMP Rest API response?
- How to fetch products with the price in a page on woocommerce using a form or live search with php
- Making a Template for a CPT created by a plugin
- How to use JSON data from URL into table on my wordpress website
- how to add a button next to the wordpress view button?
- Display by Category in Admin
- Search for categories
- auto populate list of questions if user select a category xyz
- wp_remote_get() returns 403 while file_get_contents() does not
- Limit post creation by role
- Redirecting thousands of posts that currently have no category in their permalink when changing permalink structure to include category
- Post injections into Site Origins Page builder [closed]
- Custom Post Type + Categories
- How to disable search as you type plugin suggestions?
- Customize permalink wordpress category id
- Set plugin-values when creating post via REST-API
- Automatically Assign Author to Category [closed]
- Custom Pages for Woocommerce Product-Category Pages
- polylang + category/tag custom language link
- Make a custom_post translatable
- How to password protect a category page / not posts?
- Mq translate plugin custom post type issue
- How to display taxonomy images with wp_list_categories?
- WordPress does not show products when the value of post_parent is not 0
- Using arbitrary paths in page urls
- “Custom Post Type Permalinks” plugin URL strcuture
- Unable to delete custom post types, confusion around capabilities
- WordPress “Categories to tags converter” not working. Pointing to import.php instead
- WordPress api call using wp-ajax returns error 400
- How do I apply style to each category of a list?
- Adding CSS to custom post type admin page causes error