456 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 1+ members
  • Has sold $100+ on Envato Market
  • Has collected 10+ items on Envato Market
+3 more
godonholiday says

I was wondering if it is possible when creating the custom types, if when the post is published, it is automatically set a category?

I have created a custom post type : Green articles, and I can hide the categories, or show them. But I want the post to be added to the green category automatically?

Is that possible?

1799 posts
  • Has referred 1+ members
  • Has sold $5,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+4 more
BroOf says

I ask me the same thing.

456 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 1+ members
  • Has sold $100+ on Envato Market
  • Has collected 10+ items on Envato Market
+3 more
godonholiday says

Yeah, no one really has an answer for this….

2445 posts
  • Has referred 100+ members
  • Has sold $100+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+3 more
digitalimpact says

I think it defaults to the first one, alphabetically.

I’m developing a real estate solution based on WP for a client and will look into this, since up until now I haven’t mingled with “categories” custom taxonomies (only tag-like).

Good thinking, I will also need to specify a default category, so hope it doesn’t only default to alphabetical :)

381 posts
  • Has referred 500+ members
  • Has sold $250,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+6 more
redfactory says
2445 posts
  • Has referred 100+ members
  • Has sold $100+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+3 more
digitalimpact says

Long live Google :)

So you basically just have to change that categories array to dynamically fetch the custom categories of your custom post type, right?

Looks simple, thanks redfactory! :)

381 posts
  • Has referred 500+ members
  • Has sold $250,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+6 more
redfactory says
Long live Google :)

So you basically just have to change that categories array to dynamically fetch the custom categories of your custom post type, right?

Looks simple, thanks redfactory! :)

Haha no I actually follow their rss feed in my iGoogle :p You’re welcome!

456 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 1+ members
  • Has sold $100+ on Envato Market
  • Has collected 10+ items on Envato Market
+3 more
godonholiday says

Thanks for that. BUT That code requires knowing the posts id and then automatically setting that to have a specific category.

I dont know what my post id will be? How can I apply this to all the posts from a custom post type?

I’ll keep working at it.

2445 posts
  • Has referred 100+ members
  • Has sold $100+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+3 more
digitalimpact says

As I said, instead of that categories array, you should fetch them all, dynamically.

Read here for more.

456 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 1+ members
  • Has sold $100+ on Envato Market
  • Has collected 10+ items on Envato Market
+3 more
godonholiday says

OK, so I can pull all the categories in, and say which category ID to apply… BUT I can not apply that to my custom post type? I have to declare the post id? I dont know that yet and want to apply it obviously to more than one post, all the posts from the custom post i created.

by
by
by
by
by
by