Hidden Category
Author | Posts |
---|---|
April 11, 2013 at 12:00 am 2012 | |
Sparhamster | I have 2 different forms. each of that forms is for one category which has to be in the database. the user shouldn't be allowed to uncheck it. i used TDO Mini Forms before and there was a possibility to set a default category. if u tell me the code line before u insert it into the database, i will add it for myself ;) |
April 11, 2013 at 12:49 am 2014 | |
Tareq Hasan | Here you go |
April 11, 2013 at 12:55 pm 2042 | |
Sparhamster | the category has to be additional to the selected categories. for example: category 23, 56 and 117 are selected. category 1 has to be added. |
April 12, 2013 at 1:33 am 2063 | |
Tareq Hasan | So your form will have category dropdown or checkbox. But you want to add an additional category automatically after the post has been submitted? |
April 12, 2013 at 4:47 am 2071 | |
Sparhamster | Yes my form have checkbox for category. “But you want to add an additional category automatically after the post has been submitted?” -> Yes i do 😉 array_push($_POST[‘Category’], “1″); ? |
April 12, 2013 at 10:27 am 2077 | |
Tareq Hasan | You should be trying like this: add_filter( ‘wpuf_add_post_args’, ‘wpufe_add_category’ ); |
April 12, 2013 at 3:19 pm 2104 | |
Sparhamster | Thx a lot.. but u forgot the return value 😉 function wpufe_add_category( $postarr ) { worked 😉 |