Did you try re-saving your permalinks(Settings -> Permalinks -> Click on save button)?
Kind regards
Thread Starter
ema15
(@ema15)
I do so and nothing changed. A I said I developed a custom post type and I want to assign a default category to article without category when saving the article.
Did you know how to achieve that(with code)?
Thank you in advance.
Thread Starter
ema15
(@ema15)
Thank you @prashantvatsh for your help. I already test a code similar to this code, but I didn’t understand the 3rd and 4th parameter of add_action:
add_action( ‘save_post’, ‘mfields_set_default_object_terms’, 100, 2 );
Thread Starter
ema15
(@ema15)
Thank you again @prashantvatsh. I will go back to you once it’s done.
Thread Starter
ema15
(@ema15)
It’s working perfectly. Thank you @prashantvatsh.
Thread Starter
ema15
(@ema15)
Do you have any idea how to assign the default term for posts already published?.
I have multiple posts without category, so it’s difficult to update manualy each post.
In other words, which hook I have to use?
Thank you in advance.
Thread Starter
ema15
(@ema15)
Hi,
I tried with the code you send to me. I added a default category which is by default assign to a new article. When I tried to add a new article, cheek another category and uncheck the default one , the article was duplicate two times, one with the default category and other with the chosen category.
So how can I publish article with the chosen category?.
I hope it was clear.
Thank you in advance.