456 posts
  • 8 Years of Membership
  • Affiliate Level 1
  • Author Level 2
  • Collector Level 2
+2 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
  • Affiliate Level 1
  • Author Level 4
  • Beta Tester
  • Collector Level 2
+4 more
BroOf
says

I ask me the same thing.

456 posts
  • 8 Years of Membership
  • Affiliate Level 1
  • Author Level 2
  • Collector Level 2
+2 more
godonholiday
says

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

2468 posts
  • 7 Years of Membership
  • Exclusive Author
  • Author Level 2
  • Collector Level 2
+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
  • Trendsetter
  • Weekly Top Seller
  • Elite Author
  • Most Wanted Winner
+8 more
redfactory
says
2468 posts
  • 7 Years of Membership
  • Exclusive Author
  • Author Level 2
  • Collector Level 2
+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
  • Trendsetter
  • Weekly Top Seller
  • Elite Author
  • Most Wanted Winner
+8 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
  • 8 Years of Membership
  • Affiliate Level 1
  • Author Level 2
  • Collector Level 2
+2 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.

2468 posts
  • 7 Years of Membership
  • Exclusive Author
  • Author Level 2
  • Collector Level 2
+3 more
digitalimpact
says

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

Read here for more.

456 posts
  • 8 Years of Membership
  • Affiliate Level 1
  • Author Level 2
  • Collector Level 2
+2 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